Skip to content

Commit 3628b1e

Browse files
afscromeasosMikeGore
authored andcommitted
Avoid corrupting stack for non concurrency cosmos errors (#46)
Use an exception filter to avoid modifying the stack when a DocumentClientException is thrown that isn't a concurrency error.
1 parent 18d02e4 commit 3628b1e

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/SimpleEventStore/SimpleEventStore.AzureDocumentDb/AzureDocumentDbStorageEngine.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,9 @@ public async Task AppendToStream(string streamId, IEnumerable<StorageEvent> even
7575

7676
loggingOptions.OnSuccess(ResponseInformation.FromWriteResponse(nameof(AppendToStream), result));
7777
}
78-
catch (DocumentClientException ex)
78+
catch (DocumentClientException ex) when (ex.Error.Message.Contains(ConcurrencyConflictErrorKey))
7979
{
80-
if (ex.Error.Message.Contains(ConcurrencyConflictErrorKey))
81-
{
82-
throw new ConcurrencyException(ex.Error.Message, ex);
83-
}
84-
85-
throw;
80+
throw new ConcurrencyException(ex.Error.Message, ex);
8681
}
8782
}
8883

0 commit comments

Comments
 (0)