This commit is contained in:
2020-03-06 20:26:42 +00:00
parent 1eaf564851
commit 1d874d8d1f
20 changed files with 70 additions and 72 deletions

View File

@@ -5,8 +5,8 @@ var lastMessageHash = 0;
////////////////////////////////////////////////////////
//
// Localize, Log and optionally display errors
// return localized message in case caller needs it
// translate, Log and optionally display errors
// return translated message in case caller needs it
function dealWithError(msg, vm) {
//Check if this is the same message again as last time to avoid
//repetitive loops of useless messages
@@ -16,10 +16,10 @@ function dealWithError(msg, vm) {
}
lastMessageHash = newHash;
//localize as necessary
//translate as necessary
msg = window.$gz.translation.translateString(msg);
//In some cases the error may not be localizable, if this is not a debug run then it should show without the ?? that localizing puts in keys not found
//In some cases the error may not be translatable, if this is not a debug run then it should show without the ?? that translating puts in keys not found
//so it's not as weird looking to the user
if (!devModeShowErrors && msg.includes("??")) {
msg = msg.replace("??", "");
@@ -103,11 +103,11 @@ export default {
dealWithError(msg);
},
/////////////////////////////////////////////////
// Localize, log and return error
// translate, log and return error
//
handleFormError(err, vm) {
//called inside forms when things go unexpectedly wrong
//returns the localized message in case the form wants to display it as well
//returns the translated message in case the form wants to display it as well
if (err instanceof Error && err.message) {
dealWithError(err.message, vm);
} else {