This commit is contained in:
2019-04-01 22:34:20 +00:00
parent d059151a55
commit 48175e14fe
2 changed files with 20 additions and 15 deletions

View File

@@ -14,10 +14,6 @@ TODO CLIENT STUFF
TODO NEXT TODO NEXT
Happy Monday muthafucka! ;)
*** Add *all* api error codes to localized text over in the server project
*** Continue on with below, was at gzvalidate see area that says *****THIS!
Get broken server rule to display in vue properly Get broken server rule to display in vue properly

View File

@@ -319,8 +319,7 @@ Here are all the API level error codes that can be returned by the API server:
*/ */
var ret = []; var ret = [];
//return ret;
return ret;
//check for errors if we have any errors //check for errors if we have any errors
if (!v.$_.isEmpty(v.serverError)) { if (!v.$_.isEmpty(v.serverError)) {
@@ -344,18 +343,28 @@ return ret;
//Specific field validation errors are in an array in "details" key //Specific field validation errors are in an array in "details" key
if (!v.$_.isEmpty(v.serverError.details)) { if (!v.$_.isEmpty(v.serverError.details)) {
//See if this key is in the details array //See if this key is in the details array
var errorsForField= v.$_.where(v.serverError.details, {target: ref}); var errorsForField = v.$_.filter(v.serverError.details, {
if(errorsForField.length>0){ target: ref
*****THIS! });
if (errorsForField.length > 0) {
var allFldErrors = "";
//iterate the errorsForField objects, build a return message for each error separated by a newline and Bob's your lobster //iterate the errorsForField objects, build a return message for each error separated by a newline and Bob's your lobster
v.$_.each(errorsForField,function(ve){ v.$_.each(errorsForField, function(ve) {
var err=""; var fldErr = "";
if(ve.message){ var fldErrorCode = parseInt(ve.error);
err=err+ve.message; fldErr =
v.$gzlocale.get("ErrorAPI" + fldErrorCode.toString()) +
" [" +
ve.error +
"]";
if (ve.message) {
fldErr += ve.message;
} }
}) allFldErrors += fldErr + "\n";
} });
return allFldErrors.trimRight("\n");
}
} else { } else {
if (v.$gzdevmode()) { if (v.$gzdevmode()) {
throw "DEV ERROR gzvalidate::ServerErrors -> on field validation error no 'details' key was found to show which field had the error"; throw "DEV ERROR gzvalidate::ServerErrors -> on field validation error no 'details' key was found to show which field had the error";