diff --git a/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocumentJob.cs b/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocumentJob.cs index 9e336c80..5b405901 100644 --- a/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocumentJob.cs +++ b/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocumentJob.cs @@ -36,6 +36,8 @@ public class FinalizeDocumentJob(IOptions options, IConfiguration public byte[]? DocAsByte { get; set; } } + public bool RethrowOnError { get; set; } = true; + public async Task ExecuteAsync(CancellationToken cancel = default) { var gdPictureKey = _options.GdPictureLicenseKey; @@ -63,8 +65,10 @@ public class FinalizeDocumentJob(IOptions options, IConfiguration } catch (Exception ex) { - logger.LogError(ex); - logger.LogWarning(ex, "Unhandled exception while working envelope [{id}]", envelope.Id); + logger.LogError(ex, "Unhandled exception while working envelope [{id}]", envelope.Id); + + if(RethrowOnError) + throw; } logger.LogInformation("Envelope [{id}] finalized!", envelope.Id);