Skip to content

Commit b0f260b

Browse files
committed
Fixes FailChunkExecution does not handle DbExceptions wrapped in an AggregateException (akkadotnet#6361)
1 parent ba9ff3e commit b0f260b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/BatchingSqlJournal.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,12 @@ protected sealed override bool Receive(object message)
762762
private void FailChunkExecution(ChunkExecutionFailure message)
763763
{
764764
_remainingOperations++;
765-
var cause = message.Cause;
765+
766+
var cause = message.Cause is AggregateException aggregateException
767+
? aggregateException.Flatten().InnerExceptions.OfType<DbException>().FirstOrDefault()
768+
?? aggregateException.Flatten().InnerExceptions[0]
769+
: message.Cause;
770+
766771
Log.Error(cause, "An error occurred during event batch processing. ChunkId: [{0}], batched requests: [{1}]", message.ChunkId, message.Requests.Length);
767772

768773
foreach (var request in message.Requests)

0 commit comments

Comments
 (0)