Skip to content

Commit

Permalink
Catch errors when studio is not running and mail tries to send
Browse files Browse the repository at this point in the history
  • Loading branch information
cannikin committed Aug 29, 2024
1 parent ddf850d commit bde2ae9
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: any) {
console.error(
'\nSent an email to the void! You can view this email during development\nwith Redwood Studio: `yarn rw studio`',
)
console.error(' ' + e.message + '\n')
}

return {}
}

internal() {
Expand Down

0 comments on commit bde2ae9

Please sign in to comment.