-
-
Notifications
You must be signed in to change notification settings - Fork 280
feat(validateFields): add message to reject error type #748
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
概述演练这个拉取请求引入了对验证错误处理的增强。在 变更
序列图sequenceDiagram
participant User
participant FormStore
participant Validator
User->>FormStore: validateFields()
FormStore->>Validator: 执行字段验证
Validator-->>FormStore: 返回错误列表
FormStore->>FormStore: 提取第一个错误消息
FormStore-->>User: 返回带错误消息的结果
诗歌
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
🔇 Additional comments (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 (
|
11349b9 to
7497571
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #748 +/- ##
=======================================
Coverage 99.44% 99.44%
=======================================
Files 18 18
Lines 1258 1259 +1
Branches 311 311
=======================================
+ Hits 1251 1252 +1
Misses 7 7 ☔ View full report in Codecov by Sentry. |
在日常开发中,有时会使用链式 promise 调用:
但是当表单校验失败时,弹出的 message 是空的,因为 validateFields 的 reject 返回并非标准 Error 对象,没有 message 属性。
此 PR 为 validateFields 的 reject 返回增加 message,使其更像一个 Error 对象。在需要展示 popup message 的场景能够更便捷的取值。降低开发者学习和使用的成本。
Summary by CodeRabbit
新功能
Bug 修复
这些更改旨在提供更详细和清晰的验证错误信息,帮助用户更好地理解和解决表单验证问题。