Skip to content

Commit

Permalink
Merge pull request #5134 from mozilla/MNTOR-3672
Browse files Browse the repository at this point in the history
MNTOR-3672: error log format
  • Loading branch information
mansaj authored Oct 4, 2024
2 parents c03631a + bd2c5cc commit 23c8a88
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/db/tables/subscriber_email_preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ async function addEmailPreferenceForSubscriber(
logger.debug("add_email_preference_for_subscriber_success");
} catch (e) {
logger.error("error_add_subscriber_email_preference", {
exception: e as string,
message: (e as Error).message,
stack_trace: (e as Error).stack,
});

throw e;
Expand Down Expand Up @@ -119,7 +120,8 @@ async function updateEmailPreferenceForSubscriber(
logger.debug("update_email_preference_for_subscriber_success");
} catch (e) {
logger.error("error_update_subscriber_email_preference", {
exception: e as string,
message: (e as Error).message,
stack_trace: (e as Error).stack,
});

throw e;
Expand Down Expand Up @@ -161,7 +163,8 @@ async function getEmailPreferenceForSubscriber(subscriberId: number) {
);
} catch (e) {
logger.error("error_get_subscriber_email_preference", {
exception: e as string,
message: (e as Error).message,
stack_trace: (e as Error).stack,
});

throw e;
Expand Down Expand Up @@ -195,7 +198,8 @@ async function getEmailPreferenceForUnsubscribeToken(unsubscribeToken: string) {
logger.error(
"error_get_subscriber_email_preference_for_unsubscribe_token",
{
exception: e as string,
message: (e as Error).message,
stack_trace: (e as Error).stack,
},
);

Expand Down Expand Up @@ -230,7 +234,8 @@ async function unsubscribeMonthlyMonitorReportForUnsubscribeToken(
logger.error(
"error_unsubscribe_monthly_monitor_report_for_unsubscribe_token",
{
exception: e,
message: (e as Error).message,
stack_trace: (e as Error).stack,
},
);
captureException(e);
Expand Down Expand Up @@ -274,7 +279,8 @@ async function getEmailPreferenceForPrimaryEmail(email: string) {
);
} catch (e) {
logger.error("error_get_subscriber_email_preference_for_primary_email", {
exception: e as string,
message: (e as Error).message,
stack_trace: (e as Error).stack,
});

throw e;
Expand Down

0 comments on commit 23c8a88

Please sign in to comment.