File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { env } from "~/env.server";
66import type { User } from "~/models/user.server" ;
77import type { AuthUser } from "./authUser" ;
88import { workerQueue } from "./worker.server" ;
9+ import { logger } from "./logger.server" ;
910
1011const client = new EmailClient ( {
1112 apikey : env . RESEND_API_KEY ,
@@ -20,11 +21,18 @@ export async function sendMagicLinkEmail(options: SendEmailOptions<AuthUser>): P
2021 throw redirect ( options . magicLink ) ;
2122 }
2223
23- return client . send ( {
24- email : "magic_link" ,
25- to : options . emailAddress ,
26- magicLink : options . magicLink ,
27- } ) ;
24+ logger . debug ( "Sending magic link email" , { emailAddress : options . emailAddress } ) ;
25+
26+ try {
27+ return await client . send ( {
28+ email : "magic_link" ,
29+ to : options . emailAddress ,
30+ magicLink : options . magicLink ,
31+ } ) ;
32+ } catch ( error ) {
33+ logger . error ( "Error sending magic link email" , { error : JSON . stringify ( error ) } ) ;
34+ throw error ;
35+ }
2836}
2937
3038export async function sendPlainTextEmail ( options : SendPlainTextOptions ) {
You can’t perform that action at this time.
0 commit comments