wasp
wasp copied to clipboard
Email sending errors are silently caught in sendEmailAndSaveMetadata
Current Behavior
In sendEmailAndSaveMetadata, email sending errors are caught and only logged, but not propagated:
emailSender.send(content).catch((e) => { console.error('Failed to send email', e); });
This means:
- The function always appears to succeed even when email sending fails
- The error cannot be handled by the calling code
- Users don't receive proper error feedback in the UI
Expected Behavior
Email sending errors should be propagated so they can be:
- Properly handled by the calling code
- Converted to appropriate HTTP errors
- Displayed to users in the frontend
Proposed Solution
Change the code to: await emailSender.send(content); // Let errors propagate
This allows proper error handling in actions/APIs that use these email functions.
Impact
This change would improve:
- Error visibility and debugging
- User experience with proper error messages
- Ability to handle email sending failures appropriately
Additional Context
This issue was discovered when implementing email verification where users weren't seeing proper error messages when email sending failed.