New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

afterValidate hook is not called when validation fails #1626

Closed
alekbarszczewski opened this Issue Apr 11, 2014 · 3 comments

Comments

4 participants
@alekbarszczewski
Contributor

alekbarszczewski commented Apr 11, 2014

When validation errors occur (for example during Model.create(...) then afterValidate hook is not called. It would be a good feature to be able to catch validation errors in a hook - is it possible?

If not maybe you could implement this functionality in new version?
For example like this:

hooks: { afterValidate: function(model, done) { console.error(model.validationErrors)... } }

or

hooks: { afterValidationFailed: function(err, model, done) { ... } }

or something like this.

@mickhansen

This comment has been minimized.

Contributor

mickhansen commented Apr 12, 2014

This would break BC - Although i'm not sure who uses that hook, but you never know.
The problem is also that the signature for that method is still model.

But yeah we could definitely add a validation failed hook i suppose, that wouldn't interfere with anything.

@ptusch

This comment has been minimized.

ptusch commented Oct 15, 2015

Push

It would be nice to work with failed validation.

@janmeier

This comment has been minimized.

Member

janmeier commented Feb 21, 2016

Added in #5196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment