This commit is contained in:
2020-02-12 23:06:33 +00:00
parent aad01ff0a8
commit a0da3207e4
6 changed files with 104 additions and 79 deletions

View File

@@ -45,6 +45,10 @@ function dealWithError(msg, vm) {
}
}
vm.formState.appError = msg;
//TODO: What is this doing exactly?
//it's related to server errors but I'm setting appError above
//why two error properties?
window.$gz.form.setErrorBoxErrors(vm);
}
}
@@ -101,12 +105,14 @@ export default {
// Localize, log and return error
//
handleFormError(err, vm) {
//called inside forms when things go wrong
//called inside forms when things go unexpectedly wrong
//returns the localized message in case the form wants to display it as well
if (err instanceof Error && err.message) {
dealWithError(err.message, vm);
} else {
dealWithError(err.toString(), vm);
//TODO: this is pretty bad
var msg = JSON.stringify(err);
dealWithError(msg, vm);
}
}
};