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

关于request模块错误处理的建议 #32

Open
chenchi2038 opened this issue Oct 26, 2020 · 2 comments
Open

关于request模块错误处理的建议 #32

chenchi2038 opened this issue Oct 26, 2020 · 2 comments

Comments

@chenchi2038
Copy link
Contributor

相关代码:https://github.com/CareyToboo/ovine/blob/master/packages/core/src/utils/request/index.ts
requestErrorCtrl函数在处理异常响应时,一定会抛出异常,而框架会捕捉异常并通过toast进行显示,这一行为无法禁用。
如果想在全局的onError方法中解析并显示错误信息,就会同时出现2条toast信息,希望能有办法自行配置,在遇到错误时是否抛出异常。

image

@jinmingpang
Copy link
Member

用户名和密码错误,是怎么出现的这个提示? 这边出现两条toast是不正常的。

@gunnerliu
Copy link

可以直接在全局的 onError 处理中抛出 throw new errors_1.ServerError(errorMsg, response); 我这样试下来是一个弹框

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

3 participants