Skip to content

Commit 8a8b2bd

Browse files
authored
Merge pull request #102 from topcoder-platform/hotfix/email-logging
add logging for failed email post events
2 parents ff6ac70 + d57d0b5 commit 8a8b2bd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

connect/notificationServices/email.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ function handleScheduledEvents(events, setEventsStatus) {
123123
+ ` with body ${JSON.stringify(eventMessage)} to bus api`);
124124

125125
setEventsStatus(userEvents, SCHEDULED_EVENT_STATUS.COMPLETED);
126-
}).catch(() => {
126+
}).catch((err) => {
127127
logger.error(`Failed to send ${BUS_API_EVENT.EMAIL.GENERAL} event`
128-
+ ` with body ${JSON.stringify(eventMessage)} to bus api`);
128+
+ `; error: ${err.message}`
129+
+ `; with body ${JSON.stringify(eventMessage)} to bus api`);
129130

130131
setEventsStatus(userEvents, SCHEDULED_EVENT_STATUS.FAILED);
131132
});
@@ -343,6 +344,11 @@ function handler(topicName, messageJSON, notification) {
343344
payload: eventMessage,
344345
}).then(() => {
345346
logger.info(`Successfully sent ${eventType} event with body ${JSON.stringify(eventMessage)} to bus api`);
347+
})
348+
.catch((err) => {
349+
logger.error(`Failed to send ${eventType} event`
350+
+ `; error: ${err.message}`
351+
+ `; with body ${JSON.stringify(eventMessage)} to bus api`);
346352
});
347353
}
348354
});

0 commit comments

Comments
 (0)