Add admin emailing

This commit is contained in:
2016-04-13 11:57:36 -04:00
parent 0c3191d7c6
commit 515ac6ef91
3 changed files with 29 additions and 6 deletions
+12 -2
View File
@@ -81,7 +81,12 @@ namespace LeafWeb.Web.Services
}
catch (PiscalClientException ex)
{
logger.Error("LeafInputFile: {0}, ProcessQueue Exception: {1}", pending.Id, ex.Message);
var errorMessage =
$"LeafInputFile: {pending.Id}\r\nProcessRunning Exception: {ex.Message}"
+ $"\r\nInnerException: {ex.InnerException}\r\nStackTrace: {ex.StackTrace}";
logger.Error(errorMessage);
BackgroundJob.Enqueue(() => _emailService.SendAdministratorMessage("LeafWeb ProcessQueue Exception", errorMessage));
_dataService.SetLeafInputStatus(pending, LeafInputStatusType.Exception, "Error occurred starting LeafInput", ex.Message);
logger.Info("LeafInputFile: {0}, Cleanup", pending.Id);
_piscalService.Cleanup(pending);
@@ -140,7 +145,12 @@ namespace LeafWeb.Web.Services
}
catch (Exception ex)
{
logger.Error("LeafInputFile: {0}, ProcessRunning Exception: {1}\r\n{2}\r\n{3}", leafInput.Id, ex.Message, ex.InnerException, ex.StackTrace);
var errorMessage =
$"LeafInputFile: {leafInput.Id}\r\nProcessRunning Exception: {ex.Message}"
+ $"\r\nInnerException: {ex.InnerException}\r\nStackTrace: {ex.StackTrace}";
logger.Error(errorMessage);
BackgroundJob.Enqueue(() => _emailService.SendAdministratorMessage("LeafWeb ProcessRunning Exception", errorMessage));
_dataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Exception, "Error occurred processing LeafInput", ex.Message);
// TODO: Send email