Skip to content

Vue 2.5的新特性errorCaptured不能捕获到异步错误,例如发送一个ajax请求,在ajax内抛出一个Error, #7074

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

Closed
h330894169 opened this issue Nov 17, 2017 · 1 comment

Comments

@h330894169
Copy link

Version

2.5.2

Reproduction link

https://vuejs.org/v2/examples/

Steps to reproduce

在created回调方法里面写一个setTimeout 模拟,抛出error,errorCaptured无法捕捉,如果是同步throw new Error() 就能捕获

What is expected?

errorCaptured能捕获异步promise内部抛出的错误,

What is actually happening?

不能捕获error

@yyx990803
Copy link
Member

文档明确写了异步错误无法捕捉,要你自己处理。这是 js 的语言机制决定的。

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

No branches or pull requests

2 participants