From d57d0b53582be0fa3056512b40ca026a6f6dde12 Mon Sep 17 00:00:00 2001 From: Samir Date: Tue, 9 Apr 2019 17:35:46 +0200 Subject: [PATCH] add logging for failed email post events --- connect/notificationServices/email.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/connect/notificationServices/email.js b/connect/notificationServices/email.js index ff6b849..3078f95 100644 --- a/connect/notificationServices/email.js +++ b/connect/notificationServices/email.js @@ -123,9 +123,10 @@ function handleScheduledEvents(events, setEventsStatus) { + ` with body ${JSON.stringify(eventMessage)} to bus api`); setEventsStatus(userEvents, SCHEDULED_EVENT_STATUS.COMPLETED); - }).catch(() => { + }).catch((err) => { logger.error(`Failed to send ${BUS_API_EVENT.EMAIL.GENERAL} event` - + ` with body ${JSON.stringify(eventMessage)} to bus api`); + + `; error: ${err.message}` + + `; with body ${JSON.stringify(eventMessage)} to bus api`); setEventsStatus(userEvents, SCHEDULED_EVENT_STATUS.FAILED); }); @@ -343,6 +344,11 @@ function handler(topicName, messageJSON, notification) { payload: eventMessage, }).then(() => { logger.info(`Successfully sent ${eventType} event with body ${JSON.stringify(eventMessage)} to bus api`); + }) + .catch((err) => { + logger.error(`Failed to send ${eventType} event` + + `; error: ${err.message}` + + `; with body ${JSON.stringify(eventMessage)} to bus api`); }); } });