-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Hello, first of all thanks for this useful package 👍
Then, I'm running in couple of problems and I was wondering if someone had already went trough these:
-
For some model I have a complex creation logic and I want so skip standard validation for some creation flows. For doing this I have custom
beforeCreateorbeforeValidatefor some models. What I would like to do is to manually throw your "patched" validation error if some conditions occurs. Is it possible? How? -
In my controllers when I return a response in json I check whether or not there are errors. I check
error.Errorsin case a validation error occurs. But this is not always the case, and in many cases the structure of the errors messages are really different. How to manage this?
So far I've came to a simple
var errors = err.Errors || err.message || "Unknown Error";
response.json(status, {'errors': errors});
but this is not always the case, because the structure of the error can change, depending on the type of error. I know it's a broad question but I was wondering if you already faced this kind of problems.
Thanks!