This commit is contained in:
@@ -6,10 +6,10 @@ var devModeShowErrors = false;
|
|||||||
|
|
||||||
//TODO: tie this into form error display somehow so that form can control whether to show particular error or not
|
//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)
|
//i.e. dealwitherror(msg,formerrordisplayfunction,bool shouldshowError)
|
||||||
function dealWithError(msg) {
|
function dealWithError(msg, displayToUser) {
|
||||||
msg = locale.translateString(msg);
|
msg = locale.translateString(msg);
|
||||||
store.commit("logItem", msg);
|
store.commit("logItem", msg);
|
||||||
if (devModeShowErrors) {
|
if (displayToUser || devModeShowErrors) {
|
||||||
alert("~" + msg);
|
alert("~" + msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,12 +56,12 @@ export default {
|
|||||||
}
|
}
|
||||||
dealWithError(msg);
|
dealWithError(msg);
|
||||||
},
|
},
|
||||||
handleFormError(err) {
|
handleFormError(err, displayToUser) {
|
||||||
//called inside forms when things go wrong but are handled
|
//called inside forms when things go wrong but are handled
|
||||||
if (err instanceof Error && err.message) {
|
if (err instanceof Error && err.message) {
|
||||||
dealWithError(err.message);
|
dealWithError(err.message, displayToUser);
|
||||||
} else {
|
} else {
|
||||||
dealWithError(err.toString());
|
dealWithError(err.toString(), displayToUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export default {
|
|||||||
this.obj = res.data;
|
this.obj = res.data;
|
||||||
})
|
})
|
||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
that.$gzHandleFormError(error);
|
that.$gzHandleFormError(error, true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
@@ -223,7 +223,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
that.$gzHandleFormError(error);
|
that.$gzHandleFormError(error, true);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//say something so the user knows there is an issue
|
//say something so the user knows there is an issue
|
||||||
|
|||||||
Reference in New Issue
Block a user