-
Notifications
You must be signed in to change notification settings - Fork 399
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
fix: api error toast #5908
fix: api error toast #5908
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
Walkthrough此次更改涉及多个文件,主要集中在错误处理和通知逻辑的改进。 Changes
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments not posted (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files selected for processing (5)
- packages/kit/src/provider/Container/ErrorToastContainer/ErrorToastContainer.tsx (1 hunks)
- packages/shared/src/errors/errors/baseErrors.ts (3 hunks)
- packages/shared/src/errors/types/errorTypes.ts (1 hunks)
- packages/shared/src/errors/utils/errorToastUtils.ts (1 hunks)
- packages/shared/src/request/axiosInterceptor.ts (2 hunks)
Additional context used
Biome
packages/shared/src/errors/utils/errorToastUtils.ts
[error] 47-48: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
Additional comments not posted (3)
packages/kit/src/provider/Container/ErrorToastContainer/ErrorToastContainer.tsx (1)
26-26
: 好的改动!这个变更提高了
toastId
的描述性。现在它会优先使用错误代码,其次是标题,最后才是消息内容。这样做能更好地区分不同的提示,有助于调试和改善用户体验。packages/shared/src/errors/errors/baseErrors.ts (1)
62-62
: 新属性添加得当!
disableFallbackMessage
属性的加入增强了错误处理的灵活性。packages/shared/src/request/axiosInterceptor.ts (1)
88-88
: 解释新属性的用途新增的
disableFallbackMessage
属性可能会改变错误处理方式。请解释:
- 这个属性的具体作用是什么?
- 它会如何影响用户体验?
- 是否需要在其他地方做相应调整?
为了全面了解这个变更的影响,请运行以下脚本:
Verification successful
确认
disableFallbackMessage
属性的添加
disableFallbackMessage
属性在OneKeyServerApiError
类中已正确定义,并用于控制错误消息的显示。此次添加不会导致运行时错误,且符合现有的错误处理逻辑。
disableFallbackMessage
用于决定是否显示默认的错误消息。- 仅在
axiosInterceptor.ts
中添加,影响局部错误处理。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 描述:查找其他使用OneKeyServerApiError的地方,检查是否需要类似的更改。 # 测试:搜索OneKeyServerApiError的使用。预期:找到其他使用该错误类的地方。 rg --type typescript 'new OneKeyServerApiError'Length of output: 84
Script:
#!/bin/bash # 描述:查找其他使用OneKeyServerApiError的地方,检查是否需要类似的更改。 # 测试:搜索OneKeyServerApiError的使用。预期:找到其他使用该错误类的地方。 rg --type ts 'new OneKeyServerApiError'Length of output: 217
Script:
#!/bin/bash # 描述:查找 OneKeyServerApiError 类的定义,检查 disableFallbackMessage 属性的作用。 # 测试:搜索 OneKeyServerApiError 类的定义。预期:找到类的定义及其属性说明。 rg --type ts 'class OneKeyServerApiError'Length of output: 146
Script:
#!/bin/bash # 描述:获取 OneKeyServerApiError 类的完整定义,以了解 disableFallbackMessage 属性的作用。 # 显示 baseErrors.ts 文件内容 cat packages/shared/src/errors/errors/baseErrors.tsLength of output: 3945
Script:
#!/bin/bash # 描述:查找 disableFallbackMessage 属性的定义位置,以确认其在 OneKeyServerApiError 中的作用。 # 搜索 disableFallbackMessage 在整个代码库中的定义 rg 'disableFallbackMessage' --type tsLength of output: 467
Summary by CodeRabbit
新功能
disableFallbackMessage
属性,以更好地控制错误消息的显示。Bug 修复
ErrorToastContainer
中toastId
的生成逻辑,以提供更具描述性的标识符。