🪵 Log error message from failed email (#693)

This commit is contained in:
Luke Vella 2023-05-13 11:39:48 +01:00 committed by GitHub
parent 1bc749e17a
commit 43757becc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,7 +81,6 @@ type SendEmailOptions<T extends TemplateName> = {
to: string;
subject: string;
props: TemplateProps<T>;
onError?: () => void;
};
export const sendEmail = async <T extends TemplateName>(
@ -107,10 +106,8 @@ export const sendEmail = async <T extends TemplateName>(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
html,
});
return;
} catch (e) {
console.error("Error sending email", templateName, e);
options.onError?.();
}
};
@ -120,6 +117,6 @@ export const sendRawEmail = async (options: Mail.Options) => {
await transport.sendMail(options);
return;
} catch (e) {
console.error("Error sending email");
console.error("Error sending email", e);
}
};