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

errorHandler获取的永远都是string不是ResponseError对像 #306

Open
ghost opened this issue Jul 20, 2022 · 1 comment
Open

errorHandler获取的永远都是string不是ResponseError对像 #306

ghost opened this issue Jul 20, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 20, 2022

errorHandler:function(err){
console.log(err)
}

err永远都是字符串,这个逻辑实在摸不透!

@xinpingwang
Copy link

requestInterceptorsresponseInterceptors 或者其他 middlewares 代码执行过程中遇到错误时抛出的异常,包括 Promise.reject 或者 throw new Error("xxx") 都会被 errorHandler 所捕获。

如果中间件没有做特殊处理的话,只有网络请求本身发生错误 errorHandler 中获取到的才是 ResponseError 类型;否则捕获到的是 Promise.reject 或者 throw 抛出的内容

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

1 participant