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

有默认的错误处理可配吗? #93

Closed
run27017 opened this issue Jul 14, 2018 · 1 comment
Closed

有默认的错误处理可配吗? #93

run27017 opened this issue Jul 14, 2018 · 1 comment

Comments

@run27017
Copy link

就是当我忘记写catch的时候,有一个默认的错误处理的地方。例如:

fly.defaultErrorHandler = function (error) {
  console.log('global catch error', error)
}

然后如果是这样,打印"global catch error":

fly.get('/url').then(response => console.log(response.data))

像下面这样,不会打印"global catch error",而是打印"local catch error":

fly.get('/url').then(response => console.log(response.data))
   .catch(error => console.log('local catch error', error)
@wendux
Copy link
Owner

wendux commented Jul 14, 2018

并没有,因为如果promise reject之后没有catch的话,程序也不会终止,并且调试工具一般都会有提示,所以fly支持这个的必要性不大

:octocat: From gitme Android

@wendux wendux closed this as completed Jul 26, 2018
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