This commit is contained in:
2019-03-28 19:27:49 +00:00
parent f07a6d4b0d
commit 66ac0b9bee

View File

@@ -221,6 +221,13 @@ export default {
// SERVER ERRORS
// Process and return server errors if any for form and field specified
ServerErrors(v, ref) {
//CHECK PREREQUISITES IN DEV MODE TO ENSURE FORM ISN"T MISSING NEEDE DATA ATTRIBUTES ETC
if (v.$gzdevmode()) {
//make sure serverErrors is defined on data
if (!v$_.has(v, "serverError")) {
throw "DEV ERROR: serverError seems to be missing from form's vue data object";
}
}
//OK, this is sketchy a bit but seems to work
//If it returns a value that is displayed as an error in the field (hides any rule errors but whatever)
//Tested and confirmed that If I make a change to the underlying data property that is housing the data used here to determine if a field has an error, and remove that error then it instantly resolves in the UI and removes the message so that's good!
@@ -296,15 +303,12 @@ Here are all the API level error codes that can be returned by the API server:
throw "gzvalidate::ServerErrors -> server returned error without code";
}
var apiErrorCode = parseInt(v.serverError.code);
//General form errors?
if (ref == "apierrors" && apiErrorCode < 2201) {
//we have a general error, format for return
// "ErrorFieldValueNotInteger": "Value must be an integer"
var err = v.$gzlocale.get("ErrorAPI"+ apiErrorCode.toString());
var err = v.$gzlocale.get("ErrorAPI" + apiErrorCode.toString());
} else {
//Specific field errors