Skip to content

Commit

Permalink
send discord notification on send sms fail
Browse files Browse the repository at this point in the history
  • Loading branch information
celineung committed Sep 11, 2024
1 parent 2beef52 commit de4efd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ describe("BrevoNotificationGateway manual", () => {
async () => {
const phones = [];

for (let i = 0; i < times; i++)
phones.push("VALID_INTERNATIONAL_FRENCH_MOBILE_PHONE_NUMBER"); // Like +33611223344
for (let i = 0; i < times; i++) phones.push("+33604028652"); // Like +33611223344
await Promise.all(
phones.map((phone, index) =>
notificationGateway.sendSms({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
NotificationId,
type TemplatedEmail,
type TemplatedSms,
castError,
emailTemplatesByName,
errors,
smsTemplatesByName,
Expand All @@ -23,6 +24,7 @@ import {
counterSendTransactEmailTotal,
} from "../../../../utils/counters";
import { createLogger } from "../../../../utils/logger";
import { notifyObjectDiscord } from "../../../../utils/notifyDiscord";
import { NotificationGateway } from "../ports/NotificationGateway";
import { BrevoNotificationGatewayRoutes } from "./BrevoNotificationGateway.routes";
import {
Expand Down Expand Up @@ -165,11 +167,16 @@ export class BrevoNotificationGateway implements NotificationGateway {
}),
)
.catch((error) => {
const castedError = castError(error);
logger.error({
notificationId,
error,
error: castedError,
message: "sendTransactSmsError",
});
notifyObjectDiscord({
_message: "Error send sms",
...castedError,
});
throw error;
});
}
Expand Down

0 comments on commit de4efd1

Please sign in to comment.