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

More informative error messages: Uncaught errors #619

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

More informative error messages: Uncaught errors #619

javiertury opened this issue Jul 5, 2017 · 4 comments
Labels
🐛 bug Unintended behavior

Comments

@javiertury
Copy link

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
Copy link
Owner

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 Unintended behavior label Jul 6, 2017
@logaretm
Copy link
Owner

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.

@fer-ri
Copy link

fer-ri commented Jul 8, 2017

same problem here, any solution?

regards


Updated: forgot to set "name" tag ..

Thanks

@logaretm
Copy link
Owner

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
Labels
🐛 bug Unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants