Skip to content

EmailService.sendEmail swallows SMTP transport errors, making callers' .catch() blocks dead code #3757

Description

@JyantiM

Describe the bug
EmailService.sendEmail catches transport/SMTP errors internally and never rethrows or returns a rejected promise. Because of this, any caller wrapping the call in .catch() ,for example UserService in user.service.ts, never receives the failure. The .catch() blocks are effectively dead code, and email send failures are silently suppressed instead of being surfaced.

To Reproduce
Steps to reproduce the behavior:

  1. Trigger a flow that sends an email through UserService (e.g. registration, password reset, notification).
  2. Force an SMTP/transport failure (bad credentials, unreachable host, timeout, etc.).
  3. Observe that the .catch() around the sendEmail call in UserService never fires, despite the email failing to send.

Expected behavior
EmailService.sendEmail should propagate transport errors , either by rethrowing the caught error or returning a promise that rejects with it ,so calling modules can properly catch and handle email failures (logging, retries, user-facing error messages, etc.).

Additional context
I'd like to work on this issue myself if it's approved, happy to submit a PR with the fix (rethrowing/propagating the error in EmailService.sendEmail and verifying UserService's catch blocks handle it correctly).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions