Add output file type, collect all files

This commit is contained in:
2016-05-18 13:05:24 -04:00
parent 4343f08733
commit 77ae03534e
19 changed files with 288 additions and 48 deletions
+10 -6
View File
@@ -31,24 +31,28 @@ namespace LeafWeb.Web.Services.PiscalQueue
protected PiscalQueueBase() : this(new DataService(), new PiscalService()) { }
protected string FormatException(Exception ex, int leafInputId)
protected string FormatException(Exception ex)
{
return
$"LeafInput: {leafInputId}{Environment.NewLine}" +
(ex is PiscalClientException ? $"LeafInput: {((PiscalClientException) ex).LeafInputId}{Environment.NewLine}" : "") +
$"Class: {GetType().Name}{Environment.NewLine}" +
$"Exception: {ex.Message}{Environment.NewLine}" +
$"Exception message: {ex.Message}{Environment.NewLine}" +
(ex.InnerException != null ? $"InnerException: {ex.InnerException}{Environment.NewLine}" : string.Empty)
+ $"StackTrace: {ex.StackTrace}";
}
protected void PiscalExceptionHandle(PiscalClientException ex, LeafInput leafInput)
protected void PiscalExceptionHandler(PiscalClientException ex, LeafInput leafInput)
{
var errorMessage = FormatException(ex, ex.LeafInputId);
var errorMessage = FormatException(ex);
Logger.Error(errorMessage);
// send admin an email
BackgroundJobEnqueueRetry<EmailNotificationService>(
email => email.SendAdministratorMessage($"LeafWeb: PiscalQueue {GetType().Name} Exception", errorMessage));
// TODO send user email too
// send user email too
BackgroundJobEnqueueRetry<EmailNotificationService>(
email => email.SendLeafWebSystemException(leafInput.Identifier, leafInput.Email));
if (leafInput != null)
{