throw "string" -> throw new Error("string"

This commit is contained in:
2020-09-16 17:37:22 +00:00
parent 3dc5f8134c
commit f67379f83f
31 changed files with 195 additions and 151 deletions

View File

@@ -1191,7 +1191,7 @@ async function populateFieldDefinitions(vm) {
"data-list/listfields?DataListKey=" + vm.dataListKey
);
if (res.error) {
throw res.error;
throw new Error(res.error);
} else {
vm.fieldDefinitions = res.data;
}
@@ -1224,7 +1224,9 @@ async function setEffectiveListView(vm) {
*/
if (vm.listViewId == null) {
throw "ay-data-list::setEffectiveListView - listViewId is not set";
throw new Error(
"ay-data-list::setEffectiveListView - listViewId is not set"
);
}
let formSettings = window.$gz.form.getFormSettings(vm.formKey);
@@ -1245,7 +1247,7 @@ async function setEffectiveListView(vm) {
);
if (res.error) {
throw res.error;
throw new Error(res.error);
} else {
vm.effectiveListView = JSON.parse(res.data);
vm.obj.name = vm.$ay.t("FilterUnsaved");
@@ -1254,7 +1256,7 @@ async function setEffectiveListView(vm) {
//listview has an id value
let res = await window.$gz.api.get("data-list-view/" + vm.listViewId);
if (res.error) {
throw res.error;
throw new Error(res.error);
} else {
vm.effectiveListView = JSON.parse(res.data.listView);
vm.obj.public = res.data.public;
@@ -1269,10 +1271,14 @@ async function setEffectiveListView(vm) {
//
function initDataObject(vm) {
if (vm.effectiveListView == null) {
throw "ay-data-list::initDataObject - effectiveListView is not set";
throw new Error(
"ay-data-list::initDataObject - effectiveListView is not set"
);
}
if (vm.fieldDefinitions == null) {
throw "ay-data-list::initDataObject - fieldDefinitions are not set";
throw new Error(
"ay-data-list::initDataObject - fieldDefinitions are not set"
);
}
let ret = [];
@@ -1360,7 +1366,9 @@ function initDataObject(vm) {
if (window.$gz.dev) {
if (vm.obj.editView.length != vm.fieldDefinitions.length) {
throw "ay-data-list-view::initDataObject - working array length not equal to total field definition length";
throw new Error(
"ay-data-list-view::initDataObject - working array length not equal to total field definition length"
);
}
}
return Promise.resolve();
@@ -1438,7 +1446,9 @@ function getDisplayForFilter(
//Nothing more to do if there isn't both a value AND an operator at this point
if (filterOperator == null || filterValue == null) {
if (window.$gz.dev) {
throw "ay-data-list-view::getDisplayForFilter Value filter missing one ore more of Operator, Value";
throw new Error(
"ay-data-list-view::getDisplayForFilter Value filter missing one ore more of Operator, Value"
);
}
return "";
}