This commit is contained in:
2020-04-22 23:03:18 +00:00
parent 77fcd633de
commit 436960b32d
5 changed files with 76 additions and 61 deletions

View File

@@ -25,14 +25,13 @@ function dealWithError(msg, vm) {
}
window.$gz.store.commit("logItem", msg);
if (window.$gz.dev) {
let errMsg =
"DEV ERROR errorHandler::devShowUnknownError - unexpected error: \r\n" +
msg;
let errMsg = "Unexpected error: \r\n" + msg;
// eslint-disable-next-line no-console
console.error(errMsg);
console.trace();
debugger;
window.$gz.eventBus.$emit("notify-error", "Dev error see log / console");
// window.$gz.eventBus.$emit("notify-error", "Dev error see log / console");
return;
}
//If a form instance was provided (vue instance)
@@ -50,6 +49,9 @@ function dealWithError(msg, vm) {
//it's related to server errors but I'm setting appError above
//why two error properties?
window.$gz.form.setErrorBoxErrors(vm);
} else {
//popup if no place to display it elsewise
window.$gz.eventBus.$emit("notify-error", msg);
}
}
export default {

View File

@@ -18,23 +18,23 @@ function stringifyPrimitive(v) {
}
}
/////////////////////////////////////////////////
// Show unexpected errors during development
//
function devShowUnknownError(error) {
if (window.$gz.dev) {
// eslint-disable-next-line
console.error("gzapi::devShowUnknownError, error is:", error);
// /////////////////////////////////////////////////
// // Show unexpected errors during development
// //
// function devShowUnknownError(error) {
// if (window.$gz.dev) {
// // eslint-disable-next-line
// console.error("gzapi::devShowUnknownError, error is:", error);
console.trace();
debugger;
// console.trace();
// debugger;
window.$gz.eventBus.$emit(
"notify-warning",
"DEV ERROR gzapi::devShowUnknownError - unexpected error during api operation see console "
);
}
}
// window.$gz.eventBus.$emit(
// "notify-warning",
// "DEV ERROR gzapi::devShowUnknownError - unexpected error during api operation see console "
// );
// }
// }
////////////////////////////////////////////
// Try to handle an api error
@@ -102,7 +102,8 @@ function handleError(action, error, route, reject) {
}
//Ideally this should never get called because any issue should be addressed above
devShowUnknownError(error);
window.$gz.errorHandler.handleFormError(error);
// devShowUnknownError(error);
}
export default {
@@ -126,6 +127,7 @@ export default {
if (response.status == 405) {
//Probably a development error
return Promise.reject(
new Error("Method Not Allowed (route issue?) " + response.url)
);
@@ -259,6 +261,18 @@ export default {
return window.$gz.store.state.apiUrl + apiPath;
},
/////////////////////////////
// Attachment download URL
//
downloadUrl(fileId) {
//http://localhost:7575/api/v8/Attachment/download/100?t=sssss
return this.APIUrl(
"Attachment/download/" +
fileId +
"?t=" +
window.$gz.store.state.downloadToken
);
},
/////////////////////////////
// REPLACE END OF URL
// (used to change ID in url)
replaceAfterLastSlash(theUrl, theReplacement) {