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
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

View File

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