fix(users.register): surface correct errorType from custom field validation#40878
fix(users.register): surface correct errorType from custom field validation#40878rish106-hub wants to merge 3 commits into
Conversation
…dation API.v1.failure(e) passed the Meteor.Error object directly, hitting the isObject branch in failure() which set body = error object. The response schema (additionalProperties: false) then rejected the extra fields and wrapped with error-invalid-body. Fix: pass e.message + e.error so failure() uses the string branch and sets errorType correctly. Closes RocketChat#40765
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: 67c7634 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (8)📚 Learning: 2026-03-16T21:50:37.589ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-05-06T12:21:44.083ZApplied to files:
📚 Learning: 2026-02-23T17:53:06.802ZApplied to files:
📚 Learning: 2026-02-24T19:09:01.522ZApplied to files:
📚 Learning: 2026-03-15T14:31:25.380ZApplied to files:
📚 Learning: 2026-03-16T23:33:11.443ZApplied to files:
🔇 Additional comments (3)
WalkthroughThe PR fixes the error type returned by ChangesCustom Field Validation Error Handling
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @ggazzo @KevLehman — this is a small bug fix for users.register where the correct errorType (error-user-registration-custom-field) was being lost in the catch block when custom field validation fails. The fix is trivial (~3 min review per CodeRabbit), all automated checks are passing (cubic, CodeRabbit, CLA), and the branch is up to date with develop. Would really appreciate a review when you get a chance! |
When users.register validates custom fields, a validation failure throws Meteor.Error('error-user-registration-custom-field'). The catch block called API.v1.failure(e) passing the error object directly, which hit the isObject branch and lost the errorType. Fix: extract e.message and e.error before calling failure(), matching the pattern in APIClass.ts global catch. Test updated to assert the correct errorType directly. Closes #40765
Summary by CodeRabbit