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

@@ -5,9 +5,9 @@ export default {
enumKey = enumKey.toLowerCase();
if (enumKey != "authorizationroles") {
if (window.$gz.store.state.enums[enumKey] == undefined) {
throw "ERROR enums::get -> enumKey " +
enumKey +
" is missing from store";
throw new Error(
"ERROR enums::get -> enumKey " + enumKey + " is missing from store"
);
}
return window.$gz.store.state.enums[enumKey][enumValue];
} else {
@@ -34,9 +34,11 @@ export default {
enumKey = enumKey.toLowerCase();
let e = window.$gz.store.state.enums[enumKey];
if (!e) {
throw "ERROR enums::getSelectionList -> enumKey " +
enumKey +
" is missing from store";
throw new Error(
"ERROR enums::getSelectionList -> enumKey " +
enumKey +
" is missing from store"
);
}
let ret = [];
//turn it into an array suitable for selection lists
@@ -85,7 +87,7 @@ export default {
let res = await window.$gz.api.get("enum-list/list/" + enumKey);
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
throw res;
throw new Error(res);
}
return res.data;
}