Closed yuri-karadzhov closed 8 years ago
@yuri-karadzhov
What version of sails-hook-validation
are you using?.
If its latest version, may you please cross-check if you have setup model or local files correct.
Latest one and yes, i do set up models with right verification. I actually saw the right info in the console but on the client side there is only an 500 error.
It actually worked sometime for me… I'm currently investigating the issue but expect it to be related to sails
itself and not sails-hook-validation
since the corresponding Errors
object will be set on the error.
I found the problem and was able to create a fix ( #40 ). There's a function in waterline
that makes sure it's a WLError
(waterline error) and if its not a WLError
it'll "errorify" it (yep, that's the name of that function). Since the hook applies a patch to the toJSON
function the error (which is a WLValidationError
and not a WLError
) will get overwritten at that point.
To make sure the errorify
function just returns our patched error, I'll have to make sure the error is a valid WLError
with a patched function.
TL;DR; my PR does the trick.
@einfallstoll
Thanks for the fix.
v0.4.5 is out with the fix
Standard errors works with blueprints and return json error object, but sails-hook-validation return 500 error with no validation details by default.