MS TryCatchBlock Finalize Documents For Each

This commit is contained in:
Developer01 2024-08-28 11:14:46 +02:00
parent fd61d4431f
commit d3ce34ee31

View File

@ -144,6 +144,7 @@ Namespace Jobs
For Each oId In oEnvelopeIds For Each oId In oEnvelopeIds
Logger.Info("Finalizing Envelope [{0}] ({1}/{2})", oId, oCurrent, oTotal) Logger.Info("Finalizing Envelope [{0}] ({1}/{2})", oId, oCurrent, oTotal)
Logger.Debug("Loading Envelope..") Logger.Debug("Loading Envelope..")
Try
Dim oEnvelope = EnvelopeModel.GetById(oId) Dim oEnvelope = EnvelopeModel.GetById(oId)
If oEnvelope Is Nothing Then If oEnvelope Is Nothing Then
Logger.Warn("Envelope could not be loaded for Id [{0}]!", oId) Logger.Warn("Envelope could not be loaded for Id [{0}]!", oId)
@ -214,6 +215,10 @@ Namespace Jobs
Logger.Warn("Envelope could not be finalized!") Logger.Warn("Envelope could not be finalized!")
Throw New ApplicationException("Envelope could not be finalized") Throw New ApplicationException("Envelope could not be finalized")
End If End If
Catch ex As Exception
Logger.Warn($"Unhandled exception while working envelope [{oId}] - [{ex.Message}]")
End Try
oCurrent += 1 oCurrent += 1
Logger.Info("Envelope finalized!") Logger.Info("Envelope finalized!")