From 3021408c526ff5ad1f13918644989561d104d87d Mon Sep 17 00:00:00 2001 From: Federico Feroldi Date: Sun, 28 Jun 2020 14:25:24 +0200 Subject: [PATCH] Log email/webhook delivery errors in application insights exceptions --- EmailNotificationActivity/handler.ts | 2 +- WebhookNotificationActivity/handler.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/EmailNotificationActivity/handler.ts b/EmailNotificationActivity/handler.ts index 6588336f..d76c65a7 100644 --- a/EmailNotificationActivity/handler.ts +++ b/EmailNotificationActivity/handler.ts @@ -165,7 +165,7 @@ export const getEmailNotificationActivityHandler = ( const error = sendResult.value; // track the event of failed delivery context.log.error(`${logPrefix}|ERROR=${error.message}`); - throw new Error("Error while sending email"); + throw new Error(`Error while sending email: ${error.message}`); } context.log.verbose(`${logPrefix}|RESULT=SUCCESS`); diff --git a/WebhookNotificationActivity/handler.ts b/WebhookNotificationActivity/handler.ts index 0ae4485a..453e31b6 100644 --- a/WebhookNotificationActivity/handler.ts +++ b/WebhookNotificationActivity/handler.ts @@ -255,7 +255,7 @@ export const getWebhookNotificationActivityHandler = ( const error = sendResult.value; context.log.error(`${logPrefix}|ERROR=${error.message}`); if (isTransientError(error)) { - throw new Error("Error while calling webhook"); + throw new Error(`Error while calling webhook: ${error.message}`); } else { return WebhookNotificationActivityResult.encode({ kind: "FAILURE",