Skip to content

Commit

Permalink
fix: handle resend error case (#5351)
Browse files Browse the repository at this point in the history
  • Loading branch information
jainpawan21 authored Apr 2, 2024
1 parent 1c07c82 commit 8d37ed2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ export class SendMessageEmail extends SendMessageBase {
message,
'error',
'mail_unexpected_error',
'Error while sending email with provider',
error.message || error.name || 'Error while sending email with provider',
command,
LogCodeEnum.MAIL_PROVIDER_DELIVERY_ERROR,
error
Expand All @@ -468,7 +468,7 @@ export class SendMessageEmail extends SendMessageBase {
status: ExecutionDetailsStatusEnum.FAILED,
isTest: false,
isRetry: false,
raw: JSON.stringify(error),
raw: JSON.stringify(error) === '{}' ? JSON.stringify({ message: error.message }) : JSON.stringify(error),
})
);

Expand Down
4 changes: 4 additions & 0 deletions providers/resend/src/lib/resend.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export class ResendEmailProvider implements IEmailProvider {
bcc: options.bcc,
});

if (response.error) {
throw new Error(response.error.message);
}

return {
id: response.data?.id,
date: new Date().toISOString(),
Expand Down

0 comments on commit 8d37ed2

Please sign in to comment.