Skip to content
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

$validator.validateAll() no longer rejects the promise on failed validation #621

Closed
alex996 opened this issue Jul 6, 2017 · 1 comment
Closed
Labels
📚 docs documentation related

Comments

@alex996
Copy link

alex996 commented Jul 6, 2017

Versions:

  • VueJs: 2.3.3
  • Vee-Validate: 2.0.0-rc.6

Description:

After updating from 2.0.0-rc.5 to 2.0.0-rc.6 I noticed strange behavior with my form. When submitted, it is being validated as follows:

this.$validator.validateAll().then(() => {
    axios.post('/some-url', this.form)
        .then((response) => {
            // ...
        })
    .catch((error) => {
        // ...
    })					
})
.catch(() => { /* */ });

Before, the code in the then promise would never be executed if the form had errors. However, I can see that after the update, the catch is never triggered, and the logic always continued in then. As a temporary fix, I reverted to evaluating the result, as suggested in #179, but I hope this will be fixed eventually.

Steps To Reproduce:

You can visit the website of the package and try out the example titled as "Validate Form Before Submit", you will see that it always returns "Form Submitted!" even though the form contains plenty of errors.

@logaretm
Copy link
Owner

logaretm commented Jul 6, 2017

The behavior was changed, to resolve to boolean instead, since rejections could mask other underlying errors. also with the upcoming async/await feature it is more friendly than having to catch the errors.

you can read the discussion about it here: #507

Few examples weren't updated yet, they should be updated now, sorry about the confusion.

@logaretm logaretm closed this as completed Jul 6, 2017
@logaretm logaretm added the 📚 docs documentation related label Jul 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 docs documentation related
Projects
None yet
Development

No branches or pull requests

2 participants