This commit is contained in:
2021-04-15 20:42:21 +00:00
parent 7ffedfb152
commit cb3ea49a32
4 changed files with 27 additions and 13 deletions

View File

@@ -487,7 +487,7 @@ export default {
//handle errors
if (err.error) {
//# FAIL ROUTE
console.log("DISPLAY RES ERROR: ", err);
console.log("RAW ERROR OBJECT: ", err);
//REHYDRATE ERRORS
//convert to form() error handling understood format
let compiledError = {
@@ -501,22 +501,27 @@ export default {
if (err.state != null) {
compiledError.details.push(err.state);
}
//bugbug: details is an array inside so there could be multiple errors for that target so need to iterate it inside the iteration
//wouldn't this just be easier to do directly inside the saves themselves??
//why compile it at all, why not make it directly ready to display at the end, there's no other use for this info really
err.items.forEach(z =>
compiledError.details.push({
message: z.e.details.message,
error: z.e.details.error,
target: `Items[${z.objectIndex}].${z.e.details.target}`
message: z.e.details[0].message,
error: z.e.details[0].error,
target: `Items[${z.objectIndex}].${z.e.details[0].target}`
})
);
err.scheduledUsers.forEach(z =>
compiledError.details.push({
message: z.e.details.message,
error: z.e.details.error,
target: `Items[${z.woItemIndex}].scheduledUsers[${z.objectIndex}].${z.e.details.target}`
message: z.e.details[0].message,
error: z.e.details[0].error,
target: `Items[${z.woItemIndex}].scheduledUsers[${z.objectIndex}].${z.e.details[0].target}`
})
);
console.log("Compiled error ", compiledError);
vm.formState.serverError = compiledError;
window.$gz.form.setErrorBoxErrors(vm);