mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-17 23:18:48 -05:00
Remove redundant try/catch block
This commit is contained in:
@@ -44,7 +44,7 @@ class EmailService {
|
||||
const templateContent = this.fs.readFileSync(templatePath, "utf8");
|
||||
return this.compile(templateContent);
|
||||
} catch (error) {
|
||||
logger.error("Error loading Email templates", {
|
||||
this.logger.error("Error loading Email templates", {
|
||||
error,
|
||||
service: this.SERVICE_NAME,
|
||||
});
|
||||
@@ -102,7 +102,7 @@ class EmailService {
|
||||
const html = await this.mjml2html(mjml);
|
||||
return html.html;
|
||||
} catch (error) {
|
||||
logger.error("Error building Email HTML", {
|
||||
this.logger.error("Error building Email HTML", {
|
||||
error,
|
||||
service: SERVICE_NAME,
|
||||
});
|
||||
@@ -118,26 +118,15 @@ class EmailService {
|
||||
});
|
||||
return info;
|
||||
} catch (error) {
|
||||
logger.error("Error sending Email", {
|
||||
this.logger.error("Error sending Email", {
|
||||
error,
|
||||
service: SERVICE_NAME,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
const info = await sendEmail(to, subject, await buildHtml(template, context));
|
||||
return info.messageId;
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
if (error.method === undefined) {
|
||||
error.method = "buildAndSendEmail";
|
||||
}
|
||||
logger.error("Error building and sending Email", {
|
||||
error,
|
||||
service: SERVICE_NAME,
|
||||
});
|
||||
}
|
||||
const html = await buildHtml(template, context);
|
||||
const info = await sendEmail(to, subject, html);
|
||||
return info?.messageId;
|
||||
};
|
||||
}
|
||||
export default EmailService;
|
||||
|
||||
Reference in New Issue
Block a user