This commit is contained in:
2019-04-08 20:10:57 +00:00
parent 3ee2909ed5
commit 12471f3090
2 changed files with 10 additions and 4 deletions

View File

@@ -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);