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

@@ -57,7 +57,7 @@ function handleError(action, error, route) {
);
router.push(window.$gz.store.state.homePage);
throw "[ErrorUserNotAuthorized]";
throw new Error("[ErrorUserNotAuthorized]");
}
//Handle 401 not authenticated
@@ -73,7 +73,7 @@ function handleError(action, error, route) {
router.push("/login");
throw "[ErrorUserNotAuthenticated]";
throw new Error("[ErrorUserNotAuthenticated]");
}
//is it a network error?
@@ -98,7 +98,7 @@ function handleError(action, error, route) {
window.$gz.eventBus.$emit("notify-error", msg);
//note: using translation key in square brackets
throw msg;
throw new Error(msg);
}
}
@@ -500,7 +500,7 @@ export default {
handleError("UPSERT", error, route);
} else {
//specifically this is for the login page
throw error;
throw new Error(error);
}
}
},
@@ -663,11 +663,13 @@ export default {
let res = await window.$gz.api.upsert("report/render", reportDataOptions);
if (res.error) {
throw res.error;
throw new Error(res.error);
} else {
let reportUrl = window.$gz.api.reportDownloadUrl(res.data);
if (window.open(reportUrl, "Report") == null) {
throw "Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting";
throw new Error(
"Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"
);
}
}
}