[BUG] Correct Error Code for Invalid Recipient Email Validation#1796
[BUG] Correct Error Code for Invalid Recipient Email Validation#1796zealot-zew wants to merge 1 commit into
Conversation
When validating recipient (mailTo) email addresses in EmailNotificationUtils.validateMailArguments(), the error reported SENDER_ADDRESS_NOT_FOUND (KER-NOE-007) instead of RECEIVER_ADDRESS_NOT_FOUND (KER-NOE-001). This caused misleading error messages: users were told 'From must be valid' when the actual problem was an invalid recipient address. Changed to use RECEIVER_ADDRESS_NOT_FOUND for the mailTo validation loop to correctly report KER-NOE-001. Signed-off-by: hari <hari@users.noreply.github.com>
|
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 (1)
WalkthroughThe email notification validation now reports the correct error code Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Summary
This PR fixes a bug in EmailNotificationUtils.java where an invalid recipient email address (mailTo) triggered a sender-related error code (KER-NOE-007) instead of the appropriate receiver-related error code (KER-NOE-001).
Problem
In the tos validation loop, the catch block was hardcoded to return SENDER_ADDRESS_NOT_FOUND. This caused API consumers to receive misleading feedback ("From must be valid") when the actual issue was an invalid "To" address.
Changes
File: EmailNotificationUtils.java
Update: Replaced SENDER_ADDRESS_NOT_FOUND with RECEIVER_ADDRESS_NOT_FOUND within the tos.forEach validation block.
Impact
Accuracy: API error responses now correctly identify the recipient as the source of the validation failure.
UX: Developers and consumers will no longer be misled by "Sender" errors when troubleshooting recipient list issues.
Summary by CodeRabbit