Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnhandledPromiseRejection if email incorrect inside try..catch #416

Closed
tandu opened this issue Nov 2, 2020 · 2 comments · Fixed by #740
Closed

UnhandledPromiseRejection if email incorrect inside try..catch #416

tandu opened this issue Nov 2, 2020 · 2 comments · Fixed by #740
Labels
bug Something isn't working

Comments

@tandu
Copy link

tandu commented Nov 2, 2020

    try {
      return this.mailerService.sendMail({
        to: 'INCORRECT EMAIL HERE',
        subject: 'Password Reset',
        template: 'reset-password-email',
        context: { password }
      });
    }
    catch(e) {
      throw new ForbiddenException(e, 'Email.NotSent');
    }

logs this in nestjs terminal

(node:14987) UnhandledPromiseRejectionWarning: Error: No recipients defined
    at SMTPConnection._formatError (/Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
    at SMTPConnection._setEnvelope (/Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-connection/index.js:995:34)
    at SMTPConnection.send (/Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-connection/index.js:615:14)
    at sendMessage (/Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-transport/index.js:227:28)
    at /Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-transport/index.js:285:25
    at SMTPConnection._actionAUTHComplete (/Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-connection/index.js:1537:9)
    at SMTPConnection.<anonymous> (/Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
    at SMTPConnection._processResponse (/Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
    at SMTPConnection._onData (/Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
    at TLSSocket.SMTPConnection._onSocketData (/Users/tandu/work/mands/Moodr/moodr-server/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14987) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14987) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.94. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@issue-label-bot issue-label-bot bot added the bug Something isn't working label Nov 2, 2020
@poirierje
Copy link

Any update ? I am facing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants