This commit is contained in:
2020-12-08 19:02:53 +00:00
parent e792050a0c
commit 4dd7adc1fd
4 changed files with 30 additions and 11 deletions

View File

@@ -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);
}
};
/*