Add output file type, collect all files
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace LeafWeb.Web.Services.PiscalQueue
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorMessage = FormatException(ex, pendingInputId);
|
||||
var errorMessage = FormatException(ex);
|
||||
Logger.Error(errorMessage);
|
||||
DataService.SetLeafInputStatus(pendingInput, LeafInputStatusType.Exception, ex.Message, errorMessage);
|
||||
}
|
||||
@@ -124,11 +124,11 @@ namespace LeafWeb.Web.Services.PiscalQueue
|
||||
}
|
||||
catch (PiscalClientException ex)
|
||||
{
|
||||
PiscalExceptionHandle(ex, leafInput);
|
||||
PiscalExceptionHandler(ex, leafInput);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorMessage = FormatException(ex, leafInput.Id);
|
||||
var errorMessage = FormatException(ex);
|
||||
Logger.Error(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,19 +16,14 @@ namespace LeafWeb.Web.Services.PiscalQueue
|
||||
}
|
||||
catch (PiscalClientException ex)
|
||||
{
|
||||
PiscalExceptionHandle(ex, leafInput);
|
||||
PiscalExceptionHandler(ex, leafInput);
|
||||
|
||||
if (leafInput != null)
|
||||
{
|
||||
DataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Exception, "Error occurred processing LeafInput",
|
||||
ex.Message);
|
||||
}
|
||||
// signal to process next item
|
||||
HangfireStartup.TriggerPiscalProcessQueue();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorMessage = FormatException(ex, leafInputId);
|
||||
var errorMessage = FormatException(ex);
|
||||
Logger.Error(errorMessage);
|
||||
throw; // this will retry via HangFire
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user