Skip to content

Commit

Permalink
Catch errors when studio is not running and mail tries to send (#11387)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh GM Walker <56300765+Josh-Walker-GM@users.noreply.github.com>
  • Loading branch information
cannikin and Josh-Walker-GM committed Aug 29, 2024
1 parent ddf850d commit f44ac78
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions packages/mailer/handlers/studio/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@ export class StudioMailHandler extends AbstractMailHandler {
sendOptions: MailSendOptionsComplete,
handlerOptions?: HandlerOptions,
): Promise<MailResult> {
return this.nodemailerHandler.send(
renderedContent,
sendOptions,
handlerOptions,
)
try {
return await this.nodemailerHandler.send(
renderedContent,
sendOptions,
handlerOptions,
)
} catch (e) {
console.error(
'\nSent an email to the void! You can view this email during development with Redwood Studio: `yarn rw studio`',
)
console.error(' ' + (e as Error).message + '\n')
}

return {}
}

internal() {
Expand Down

0 comments on commit f44ac78

Please sign in to comment.