Skip to content

Commit

Permalink
Fixes FailChunkExecution does not handle DbExceptions wrapped in an…
Browse files Browse the repository at this point in the history
… `AggregateException` (akkadotnet#6361)
  • Loading branch information
ismaelhamed authored Jan 25, 2023
1 parent a7f4d3f commit fb4fe01
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,12 @@ protected sealed override bool Receive(object message)
private void FailChunkExecution(ChunkExecutionFailure message)
{
_remainingOperations++;
var cause = message.Cause;

var cause = message.Cause is AggregateException aggregateException
? aggregateException.Flatten().InnerExceptions.OfType<DbException>().FirstOrDefault()
?? aggregateException.Flatten().InnerExceptions[0]
: message.Cause;

Log.Error(cause, "An error occurred during event batch processing. ChunkId: [{0}], batched requests: [{1}]", message.ChunkId, message.Requests.Length);

foreach (var request in message.Requests)
Expand Down

0 comments on commit fb4fe01

Please sign in to comment.