File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,13 @@ class Mail {
1919 }
2020
2121 async sendMail ( mailOptions ) {
22- const response = await this . client . sendMail ( mailOptions ) ;
23- return response ;
22+ try {
23+ const response = await this . client . sendMail ( mailOptions ) ;
24+ return response ;
25+ } catch ( error ) {
26+ console . error ( 'Failed to send email: ' , error ) ;
27+ throw new Error ( 'Email failed to send.' ) ;
28+ }
2429 }
2530
2631 async send ( data ) {
@@ -31,8 +36,13 @@ class Mail {
3136 html : data . html
3237 } ;
3338
34- const response = await this . sendMail ( mailOptions ) ;
35- return response ;
39+ try {
40+ const response = await this . sendMail ( mailOptions ) ;
41+ return response ;
42+ } catch ( error ) {
43+ console . error ( 'Error in prepping email.' , error ) ;
44+ throw new Error ( 'Error in prepping email.' ) ;
45+ }
3646 }
3747}
3848
You can’t perform that action at this time.
0 commit comments