throw "string" -> throw new Error("string"
This commit is contained in:
@@ -108,7 +108,9 @@ export default {
|
||||
//Get the AyaNova stock REQUIRED role rights for that object
|
||||
let objectRoleRights = this.ROLE_RIGHTS[typeName];
|
||||
if (!objectRoleRights) {
|
||||
throw `authorizationroles::getRights type ${oType} not found in roles collection`;
|
||||
throw new Error(
|
||||
`authorizationroles::getRights type ${oType} not found in roles collection`
|
||||
);
|
||||
}
|
||||
|
||||
//get the logged in user's role
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,9 @@ function dealWithError(msg, vm) {
|
||||
if (vm.$ay.dev) {
|
||||
//make sure formState.appError is defined on data
|
||||
if (!window.$gz._.has(vm, "formState.appError")) {
|
||||
throw "DEV ERROR errorHandler::dealWithError -> formState.appError seems to be missing from form's vue data object";
|
||||
throw new Error(
|
||||
"DEV ERROR errorHandler::dealWithError -> formState.appError seems to be missing from form's vue data object"
|
||||
);
|
||||
}
|
||||
}
|
||||
vm.formState.appError = msg;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,24 +508,32 @@ export default {
|
||||
if (vm.$ay.dev) {
|
||||
//make sure formState.serverErrors is defined on data
|
||||
if (!window.$gz._.has(vm, "formState.serverError")) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> formState.serverError seems to be missing from form's vue data object";
|
||||
throw new Error(
|
||||
"DEV ERROR gzform::formState.serverErrors -> formState.serverError seems to be missing from form's vue data object"
|
||||
);
|
||||
}
|
||||
|
||||
//make sure formState.appError is defined on data
|
||||
if (!window.$gz._.has(vm, "formState.appError")) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> formState.appError seems to be missing from form's vue data object";
|
||||
throw new Error(
|
||||
"DEV ERROR gzform::formState.serverErrors -> formState.appError seems to be missing from form's vue data object"
|
||||
);
|
||||
}
|
||||
|
||||
//make sure formState.errorBoxMessage is defined on data
|
||||
if (!window.$gz._.has(vm, "formState.errorBoxMessage")) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> formState.errorBoxMessage seems to be missing from form's vue data object";
|
||||
throw new Error(
|
||||
"DEV ERROR gzform::formState.serverErrors -> formState.errorBoxMessage seems to be missing from form's vue data object"
|
||||
);
|
||||
}
|
||||
|
||||
//ensure the error returned is in an expected format to catch coding errors at the server end
|
||||
if (!window.$gz._.isEmpty(vm.formState.serverError)) {
|
||||
//Make sure there is an error code if there is an error collection
|
||||
if (!vm.formState.serverError.code) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> server returned error without code";
|
||||
throw new Error(
|
||||
"DEV ERROR gzform::formState.serverErrors -> server returned error without code"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -802,7 +810,9 @@ export default {
|
||||
setFormSettings(formKey, formSettings) {
|
||||
if (window.$gz.dev) {
|
||||
if (!formSettings.saved && !formSettings.temp) {
|
||||
throw "gzform:setFormSettings - saved AND temp keys are both missing from form data!";
|
||||
throw new Error(
|
||||
"gzform:setFormSettings - saved AND temp keys are both missing from form data!"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -841,7 +841,7 @@ async function getUserOptions() {
|
||||
"logItem",
|
||||
"Initialize::() fetch useroptions -> error" + error
|
||||
);
|
||||
throw error;
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ async function getUserOptions() {
|
||||
export default function initialize() {
|
||||
return new Promise(async function(resolve, reject) {
|
||||
if (!window.$gz.store.state.authenticated) {
|
||||
throw "initialize: Error, called but user not authenticated!";
|
||||
throw new Error("initialize: Error, called but user not authenticated!");
|
||||
}
|
||||
try {
|
||||
await window.$gz.translation.cacheTranslations(
|
||||
|
||||
@@ -21,7 +21,7 @@ export default {
|
||||
if (keepChecking && window.$gz.store.state.authenticated) {
|
||||
status = await window.$gz.api.get("notify/new-count");
|
||||
if (status.error) {
|
||||
throw status.error;
|
||||
throw new Error(status.error);
|
||||
} else {
|
||||
window.$gz.store.commit("setNewNotificationCount", status.data);
|
||||
//success so go to default in case it was changed by an error
|
||||
|
||||
@@ -32,13 +32,13 @@ export default {
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
}
|
||||
if (res.data) {
|
||||
tid.inside = res.data;
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
throw new Error(e);
|
||||
}
|
||||
})();
|
||||
}
|
||||
@@ -69,14 +69,14 @@ export default {
|
||||
let res = await window.$gz.api.get("attachment/parent/" + tid.id);
|
||||
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
}
|
||||
if (res.data.id && res.data.id != 0) {
|
||||
this.handleOpenObjectClick(vm, res.data);
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
throw new Error(e);
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -115,7 +115,7 @@ export default {
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
}
|
||||
if (res && res.data) {
|
||||
vm.$router.push({
|
||||
@@ -125,7 +125,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
throw new Error(e);
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ export default {
|
||||
//
|
||||
tokenToDates: function(token) {
|
||||
if (token == null || token.length == 0) {
|
||||
throw "relative-date-filter-calculator: date token is null or empty";
|
||||
throw new Error(
|
||||
"relative-date-filter-calculator: date token is null or empty"
|
||||
);
|
||||
}
|
||||
|
||||
//return object contains the two dates that encompass the time period
|
||||
@@ -601,9 +603,11 @@ export default {
|
||||
break;
|
||||
|
||||
default:
|
||||
throw "realtive-date-time-filter-calculater: Date token [" +
|
||||
token +
|
||||
"] was not recognized";
|
||||
throw new Error(
|
||||
"realtive-date-time-filter-calculater: Date token [" +
|
||||
token +
|
||||
"] was not recognized"
|
||||
);
|
||||
//--------------------------
|
||||
}
|
||||
|
||||
@@ -1001,9 +1005,7 @@ export default {
|
||||
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
|
||||
// break;
|
||||
|
||||
// default:
|
||||
// throw new System.ArgumentOutOfRangeException("TOKEN", sOperator, "DataListSqlFilterCriteriaBuilder invalid filter TOKEN type [" + sValue + "] IN DATE_TIME");
|
||||
|
||||
//
|
||||
// //-----
|
||||
// }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user