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

More informative error messages: Uncaught errors #619

Closed
javiertury opened this Issue Jul 5, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@javiertury

javiertury commented Jul 5, 2017

Description:

Right now with vee-validate 2.0.0-rc6 some error messages are not very informative. For example, let's take a look at the following example.

<input id="password" name="password" type="password" v-validate="'required|confirmed:password2|min:6'" placeholder="Enter password">
<input id="password2" name="password2" type="password" placeholder="Enter password again">
<span v-show="errors.has('password')">{{ errors.first('password') }}</span>

If I use the last line to catch the validation error, everything is fine. However when it is omitted like this

<input id="password" name="password" type="password" v-validate="'required|confirmed:password2|min:6'" placeholder="Enter password">
<input id="password2" name="password2" type="password" placeholder="Enter password again">

Then I obtain a confusing error which doesn't say anything about what caused it. One could think it is an error of vee-validate, a mismatch between incompatible versions of vue and vee-validate, an error due to the unstable nature of release candidate... It's true that you are provided an error stack, but other packages like webpack may obfuscate it.

[Vue warn]: Error in mounted hook: "Error: [vee-validate]: "

found in

---> <ComponentName> at /path/to/component.vue
       <Root>
Object { message: "[vee-validate]: ", stack: "" }

I think that it would be better to catch the error within vue and log a descriptive warning like:

warning: [vee-validate] Unhandled validation error(s) for element "password2".
@logaretm

This comment has been minimized.

Show comment
Hide comment
@logaretm

logaretm Jul 5, 2017

Collaborator

It shouldn't throw any errors when validating, also there are few occurrences when it does throw the custom exception, so that could be a bug.

Collaborator

logaretm commented Jul 5, 2017

It shouldn't throw any errors when validating, also there are few occurrences when it does throw the custom exception, so that could be a bug.

@logaretm logaretm added the bug label Jul 6, 2017

@logaretm logaretm closed this in d4e23ca Jul 6, 2017

@logaretm

This comment has been minimized.

Show comment
Hide comment
@logaretm

logaretm Jul 6, 2017

Collaborator

The issue was related to the use of custom exceptions with the transpiler, I have instead decided to use native Error objects instead.

Collaborator

logaretm commented Jul 6, 2017

The issue was related to the use of custom exceptions with the transpiler, I have instead decided to use native Error objects instead.

@ghprod

This comment has been minimized.

Show comment
Hide comment
@ghprod

ghprod Jul 8, 2017

same problem here, any solution?

regards


Updated: forgot to set "name" tag ..

Thanks

ghprod commented Jul 8, 2017

same problem here, any solution?

regards


Updated: forgot to set "name" tag ..

Thanks

@logaretm

This comment has been minimized.

Show comment
Hide comment
@logaretm

logaretm Jul 8, 2017

Collaborator

@ghprod It is not yet released, so you might face similar exceptions.

Collaborator

logaretm commented Jul 8, 2017

@ghprod It is not yet released, so you might face similar exceptions.

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