From cbe5f4d3d45296fd25e4535920a98cd58a5b01f5 Mon Sep 17 00:00:00 2001 From: Corey Date: Wed, 4 Dec 2019 13:40:14 +0000 Subject: [PATCH 1/2] Log a warning when we fail to send a notification to the gov.notify api. Need to check how this code is handling retries --- .../DispatchNotification/DispatchNotificationCommandHandler.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SFA.DAS.Notifications.Application/Commands/DispatchNotification/DispatchNotificationCommandHandler.cs b/src/SFA.DAS.Notifications.Application/Commands/DispatchNotification/DispatchNotificationCommandHandler.cs index 6ea00b34..59b4c8dd 100644 --- a/src/SFA.DAS.Notifications.Application/Commands/DispatchNotification/DispatchNotificationCommandHandler.cs +++ b/src/SFA.DAS.Notifications.Application/Commands/DispatchNotification/DispatchNotificationCommandHandler.cs @@ -65,6 +65,7 @@ await _emailService.SendAsync(new EmailMessage catch (Exception ex) { await _notificationsRepository.Update(command.Format, command.MessageId, NotificationStatus.Failed); + Logger.Warn(ex, $"Error sending email for {command.MessageId}"); var httpException = ex as HttpException; From ac52f70ecc1411852076d612a6c2b6750332ec65 Mon Sep 17 00:00:00 2001 From: Corey Date: Wed, 4 Dec 2019 13:41:23 +0000 Subject: [PATCH 2/2] Better context in log message --- .../DispatchNotification/DispatchNotificationCommandHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SFA.DAS.Notifications.Application/Commands/DispatchNotification/DispatchNotificationCommandHandler.cs b/src/SFA.DAS.Notifications.Application/Commands/DispatchNotification/DispatchNotificationCommandHandler.cs index 59b4c8dd..4ba85fca 100644 --- a/src/SFA.DAS.Notifications.Application/Commands/DispatchNotification/DispatchNotificationCommandHandler.cs +++ b/src/SFA.DAS.Notifications.Application/Commands/DispatchNotification/DispatchNotificationCommandHandler.cs @@ -65,7 +65,7 @@ await _emailService.SendAsync(new EmailMessage catch (Exception ex) { await _notificationsRepository.Update(command.Format, command.MessageId, NotificationStatus.Failed); - Logger.Warn(ex, $"Error sending email for {command.MessageId}"); + Logger.Warn(ex, $"Error sending email. MessageId: {command.MessageId}"); var httpException = ex as HttpException;