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

Re-throwing error within Vue.config.errorHanlder results in error thrown twice #9445

Comments

@brillout
Copy link

brillout commented Feb 6, 2019

Version

2.5.22

Reproduction link

https://jsfiddle.net/h92m7pad/2/

Steps to reproduce

  • Run the app
  • Look at the console

What is expected?

The error is thrown once

What is actually happening?

It is thrown twice

@yyx990803
Copy link
Member

This is expected: it's possible that your code in the globalHandler itself has errors, and that error is thus reported as a potential error in your error handling code.

If you already have an error handler, you should not be throwing the error.

@brillout
Copy link
Author

brillout commented Feb 7, 2019

Yes, errors in the global handler should be thrown, but only once and not twice. Or am I missing something?

If you already have an error handler, you should not be throwing the error.

If I don't throw the error then the error get's completely swallowed: https://jsfiddle.net/d6uqhk0r/

(Thanks for Vue, it's super impressive how much you achieved.)

@yyx990803
Copy link
Member

This is now fixed - note that to avoid the error being logged twice, you need to throw the original error instead of throw new Error(err).

@brillout
Copy link
Author

brillout commented Feb 9, 2019

Awesome thanks

Lostlover pushed a commit to Lostlover/vue that referenced this issue Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment