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

Vue.config.errorHandler can not catch error throw in data function #5198

Closed
githoniel opened this issue Mar 15, 2017 · 4 comments
Closed

Vue.config.errorHandler can not catch error throw in data function #5198

githoniel opened this issue Mar 15, 2017 · 4 comments

Comments

@githoniel
Copy link

Vue.js version

2.2.4

Reproduction Link

https://jsfiddle.net/githoniel/gL3f27eg/

Steps to reproduce

throw error in data function

What is Expected?

Vue.config.errorHandler can catch it

What is actually happening?

Vue.config.errorHandler can not catch it

@githoniel githoniel changed the title Vue.config.errorHandler can not error throw in data function Vue.config.errorHandler can not catch error throw in data function Mar 16, 2017
@githoniel
Copy link
Author

githoniel commented Mar 16, 2017

Is my question too easy?
I think throwing error in vue instance's data function is very common. Many people may come across this problem.
In my view, it seems verbose to write try catch in every data function.

@posva
Copy link
Member

posva commented Mar 16, 2017

imo errors in data should be handled too because errors in computed are already handled

@githoniel I find throwing errors in data to be actually very rare

awamwang added a commit to awamwang/vue that referenced this issue Mar 17, 2017
* 'dev' of https://github.com/vuejs/vue:
  remove env vars from npm scripts
  also catch error in data() (close vuejs#5198)
  always use uid when calling performance.mark (fix vuejs#5209)
@blocka
Copy link

blocka commented Mar 29, 2017

Apologize in advance for the hijacking, but I'm really too lazy to open a new issue...

Seems errors in directives are not caught: https://jsfiddle.net/gL3f27eg/4/

@LinusBorg
Copy link
Member

This comment on a closed issue will likely be drowned in the stream of notifications, so don't expect this issue to be fixed.

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

No branches or pull requests

4 participants