wasp icon indicating copy to clipboard operation
wasp copied to clipboard

Email sending errors are silently caught in sendEmailAndSaveMetadata

Open arsser opened this issue 11 months ago • 0 comments

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:

  1. The function always appears to succeed even when email sending fails
  2. The error cannot be handled by the calling code
  3. Users don't receive proper error feedback in the UI

Expected Behavior

Email sending errors should be propagated so they can be:

  1. Properly handled by the calling code
  2. Converted to appropriate HTTP errors
  3. 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:

  1. Error visibility and debugging
  2. User experience with proper error messages
  3. 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.

arsser avatar Nov 27 '24 04:11 arsser