This commit is contained in:
@@ -28,7 +28,11 @@ ACTIONS:
|
||||
Remove the routes that were being used for inside and outside user lists as they are no longer reqd.
|
||||
$profit
|
||||
|
||||
|
||||
todo: throw new Error() code *MUST* put only a string into the constructor of error. Putting a object is wrong and will result in errors that say "Error: [object Object]"
|
||||
Search for all instances of throw new Error and ensure it's a string not an object, use stringify if necessary when all else fails
|
||||
or a central function that turns any error object into a human readable message and inserts that into the error text
|
||||
See extension-export-control.vue line 45 for example
|
||||
|
||||
todo: seeder subcontractor user no vendor attached?
|
||||
|
||||
todo: deleting customer must attempt to delete the following as they are entered "in" form and not selected externally so they are part of Customer and should delete with it:
|
||||
|
||||
@@ -68,18 +68,23 @@ function dealWithError(msg, vm) {
|
||||
// and return human readable text
|
||||
//
|
||||
function decodeError(e, vm) {
|
||||
// console.log("decodeError The e object is an object:");
|
||||
// //console.log(JSON.stringify(e));
|
||||
// console.log(typeof e === "object");
|
||||
|
||||
//empty?
|
||||
// console.log("e instanceof Error ", e instanceof Error);
|
||||
// console.log("decodeError full e object as is: ");
|
||||
// console.log(e);
|
||||
// console.log("decodeError full e object stringified: ", JSON.stringify(e));
|
||||
// console.log("decodeError is typeof:", typeof e);
|
||||
// console.log("decodeError e is instanceof Error ", e instanceof Error);
|
||||
// console.log(
|
||||
// "decodeError e is a string already: ",
|
||||
// window.$gz.util.isString(e)
|
||||
// );
|
||||
|
||||
//console.log("Object.keys(e)", Object.keys(e));
|
||||
//already a string?
|
||||
if (window.$gz.util.isString(e)) {
|
||||
return e; //nothing to do here, already a string
|
||||
}
|
||||
|
||||
//an Error object?
|
||||
if (e instanceof Error) {
|
||||
//an Error object?
|
||||
return `Error - Name:${e.name}, Message:${e.message}`;
|
||||
}
|
||||
|
||||
@@ -177,6 +182,13 @@ export default {
|
||||
handleFormError(err, vm) {
|
||||
//called inside forms when things go unexpectedly wrong
|
||||
dealWithError(decodeError(err, vm), vm);
|
||||
},
|
||||
/////////////////////////////////////////////////
|
||||
// decode error into string suitable to display
|
||||
//
|
||||
errorToString(err, vm) {
|
||||
//called inside forms when things go unexpectedly wrong
|
||||
return decodeError(err, vm);
|
||||
}
|
||||
};
|
||||
/*
|
||||
|
||||
@@ -42,7 +42,8 @@ export default {
|
||||
//call api route
|
||||
let res = await window.$gz.api.upsert(url, body);
|
||||
if (res.error) {
|
||||
throw new Error(res.error);
|
||||
//Error object constructor must be a string
|
||||
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
||||
}
|
||||
|
||||
let href = window.$gz.api.genericDownloadUrl(
|
||||
@@ -55,6 +56,7 @@ export default {
|
||||
}
|
||||
} catch (error) {
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
window.$gz.eventBus.$emit("notify-error", vm.$ay.t("JobFailed"));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -237,7 +237,8 @@ Vue.prototype.$ay = {
|
||||
return locale.currencyLocalized(value);
|
||||
}
|
||||
};
|
||||
|
||||
//disable the devtools nag
|
||||
Vue.config.devtools = false;
|
||||
new Vue({
|
||||
vuetify: Vuetify,
|
||||
router,
|
||||
|
||||
Reference in New Issue
Block a user