-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Bug: addResponseInterceptor拦截器抛出error类型错误 #4667
Labels
Comments
你可以直接throw 一个对象,而不是error,具体看你业务需求 |
swamp-y
added a commit
to swamp-y/vue-vben-admin
that referenced
this issue
Oct 17, 2024
swamp-y
added a commit
to swamp-y/vue-vben-admin
that referenced
this issue
Oct 17, 2024
正常逻辑你接口报错应该不会走 fulfilled 才对,应该会走默认的 rejected,所以你需要看看你的业务逻辑。目前示例代码是接口报错是不会进入 fulfilled逻辑,所以能直接拿到error对象。你的 PR 应该也是。你看看提供你的具体场景,后面我在详细看看吧。 |
|
16 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
Vben Admin V5
Describe the bug?
addResponseInterceptor 拦截器应通过Promise返回 response对象,否则后面的token过期处理authenticateResponseInterceptor函数,以及通用错误处理errorMessageResponseInterceptor中,回调参数error,将会得到string类型错误信息 =》
Error ${status}: ${msg}
,无法解构code,message进行自定义判断Reproduction
https://github.com/vbenjs/vue-vben-admin
System Info
Relevant log output
No response
Validations
The text was updated successfully, but these errors were encountered: