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

@@ -22,7 +22,7 @@ export default {
//fetch and populate the store
let res = await window.$gz.api.get("form-custom/" + formKey);
if (res.error) {
throw res.error;
throw new Error(res.error);
}
window.$gz.store.commit("setFormCustomTemplateItem", {
formKey: formKey,
@@ -40,16 +40,20 @@ export default {
},
getFieldTemplateValue(formKey, fieldKey) {
if (fieldKey === undefined) {
throw "ERROR form-custom-template::getFieldTemplateValue -> fieldKey not specified for template for form [" +
formKey +
"]";
throw new Error(
"ERROR form-custom-template::getFieldTemplateValue -> fieldKey not specified for template for form [" +
formKey +
"]"
);
}
let template = window.$gz.store.state.formCustomTemplate[formKey];
if (template === undefined) {
throw "ERROR form-custom-template::getFieldTemplateValue -> Store is missing form template for [" +
formKey +
"]";
throw new Error(
"ERROR form-custom-template::getFieldTemplateValue -> Store is missing form template for [" +
formKey +
"]"
);
}
//_https://lodash.com/docs#find
@@ -62,9 +66,11 @@ export default {
let tok =
window.$gz.store.state.formCustomTemplate[formKey + "_concurrencyToken"];
if (tok === undefined) {
throw "ERROR form-custom-template::getTemplateConcurrencyToken -> Store is missing concurrency token for [" +
formKey +
"]";
throw new Error(
"ERROR form-custom-template::getTemplateConcurrencyToken -> Store is missing concurrency token for [" +
formKey +
"]"
);
}
return tok;