From 66ac0b9beeb3ca6399069924e66b9fa6af3c89e4 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 28 Mar 2019 19:27:49 +0000 Subject: [PATCH] --- ayanova/src/api/gzvalidate.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ayanova/src/api/gzvalidate.js b/ayanova/src/api/gzvalidate.js index 0d6f8436..444daeca 100644 --- a/ayanova/src/api/gzvalidate.js +++ b/ayanova/src/api/gzvalidate.js @@ -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