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 {
19
19
}
20
20
21
21
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
+ }
24
29
}
25
30
26
31
async send ( data ) {
@@ -31,8 +36,13 @@ class Mail {
31
36
html : data . html
32
37
} ;
33
38
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
+ }
36
46
}
37
47
}
38
48
You can’t perform that action at this time.
0 commit comments