throw "string" -> throw new Error("string"
This commit is contained in:
@@ -478,14 +478,18 @@ export default {
|
||||
//check pre-requisites exist just in case
|
||||
if (this.$ay.dev) {
|
||||
if (!window.$gz._) {
|
||||
throw "custom-fields-control: $gz._ (lodash) is required and missing";
|
||||
throw new Error(
|
||||
"custom-fields-control: $gz._ (lodash) is required and missing"
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$ay.dev) {
|
||||
if (!this.formKey) {
|
||||
throw "custom-fields-control: formKey property is required and missing";
|
||||
throw new Error(
|
||||
"custom-fields-control: formKey property is required and missing"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ export default {
|
||||
//call api route
|
||||
let jobId = await window.$gz.api.upsert(url, body);
|
||||
if (jobId.error) {
|
||||
throw jobId.error;
|
||||
throw new Error(jobId.error);
|
||||
}
|
||||
jobId = jobId.jobId; //it's in a sub key
|
||||
//indicate loading by setting on button
|
||||
@@ -113,11 +113,11 @@ export default {
|
||||
`job-operations/status/${jobId}`
|
||||
);
|
||||
if (jobStatus.error) {
|
||||
throw jobStatus.error;
|
||||
throw new Error(jobStatus.error);
|
||||
}
|
||||
jobStatus = jobStatus.data;
|
||||
if (jobStatus == 4 || jobStatus == 0) {
|
||||
throw "Seeding job failed";
|
||||
throw new Error("Seeding job failed");
|
||||
}
|
||||
if (jobStatus == 3) {
|
||||
vm.jobActive = false;
|
||||
|
||||
@@ -593,7 +593,6 @@ export default {
|
||||
});
|
||||
|
||||
if (res.error) {
|
||||
// throw res.error;
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
|
||||
@@ -273,7 +273,7 @@ export default {
|
||||
vm.fetching = false;
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
}
|
||||
vm.searchResults = res.data;
|
||||
window.$gz.form.addNoSelectionItem(vm.searchResults);
|
||||
|
||||
@@ -89,7 +89,7 @@ export default {
|
||||
|
||||
let reportDataOptions = vm.reportDataOptions;
|
||||
if (!reportDataOptions) {
|
||||
throw "Missing report data unable to render report";
|
||||
throw new Error("Missing report data unable to render report");
|
||||
}
|
||||
reportDataOptions.ReportId = reportId;
|
||||
//Meta data from client for use by report script
|
||||
@@ -97,11 +97,13 @@ export default {
|
||||
let url = "report/render";
|
||||
let res = await window.$gz.api.upsert(url, 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"
|
||||
);
|
||||
}
|
||||
}
|
||||
this.isVisible = false;
|
||||
@@ -110,10 +112,12 @@ export default {
|
||||
async open(reportDataOptions) {
|
||||
let vm = this;
|
||||
if (reportDataOptions == null) {
|
||||
throw "report-selector:Open missing reportDataOptions";
|
||||
throw new Error("report-selector:Open missing reportDataOptions");
|
||||
}
|
||||
if (reportDataOptions.ObjectType == null) {
|
||||
throw "report-selector:Open - ObjectType is missing or empty";
|
||||
throw new Error(
|
||||
"report-selector:Open - ObjectType is missing or empty"
|
||||
);
|
||||
}
|
||||
|
||||
this.reportDataOptions = reportDataOptions;
|
||||
@@ -122,7 +126,7 @@ export default {
|
||||
`report/list/${reportDataOptions.ObjectType}`
|
||||
);
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
} else {
|
||||
this.reportList = res.data;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export default {
|
||||
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
}
|
||||
//adding this to the property will automatically have it cached by the autocomplete component
|
||||
//as cache-items has been set so this just needs to be set here once and all is well in future
|
||||
|
||||
@@ -799,7 +799,7 @@ export default {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw editType + " NOT IMPLEMENTED";
|
||||
throw new Error(`wiki-control: ${editType} NOT IMPLEMENTED`);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user