diff --git a/ayanova/src/api/errorhandler.js b/ayanova/src/api/errorhandler.js index 9c83d3de..a6dddacc 100644 --- a/ayanova/src/api/errorhandler.js +++ b/ayanova/src/api/errorhandler.js @@ -4,10 +4,17 @@ import locale from "./locale"; var devModeShowErrors = false; -//TODO: tie this into form error display somehow so that form can control whether to show particular error or not -//i.e. dealwitherror(msg,formerrordisplayfunction,bool shouldshowError) +//////////////////////////////////////////////////////// +// +// Log and optionally display errors +// function dealWithError(msg, displayToUser) { msg = locale.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 + //so it's not as wierd looking to the user + if (!devModeShowErrors && msg.includes("??")) { + msg = msg.replace("??", ""); + } store.commit("logItem", msg); if (displayToUser || devModeShowErrors) { alert("~" + msg); diff --git a/ayanova/src/api/locale.js b/ayanova/src/api/locale.js index 3257d546..44a0ed8d 100644 --- a/ayanova/src/api/locale.js +++ b/ayanova/src/api/locale.js @@ -7,7 +7,7 @@ export default { get(key) { // debugger; if (!_.has(store.state.localeText, key)) { - return "?" + key + "?"; + return "??" + key; } return store.state.localeText[key]; }, @@ -128,7 +128,6 @@ export default { var foundMatch = match[0]; var ltKey = match[1]; var newValue = this.get(ltKey); - ret = ret.replace(foundMatch, newValue); } return ret;