From 5c86817a3e167dd2ce37c437b0957b80ee80a74e Mon Sep 17 00:00:00 2001 From: Eric Green Date: Mon, 28 Oct 2024 14:34:17 -0500 Subject: [PATCH] Added ExceptionTransform for EventStreamUnexpectedMaxEventId and archived stream partitioning --- .../EventStreamUnexpectedMaxEventIdExceptionTransform.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Marten/Services/EventStreamUnexpectedMaxEventIdExceptionTransform.cs b/src/Marten/Services/EventStreamUnexpectedMaxEventIdExceptionTransform.cs index a206af1b26..0e2d521ac5 100644 --- a/src/Marten/Services/EventStreamUnexpectedMaxEventIdExceptionTransform.cs +++ b/src/Marten/Services/EventStreamUnexpectedMaxEventIdExceptionTransform.cs @@ -11,6 +11,10 @@ internal class EventStreamUnexpectedMaxEventIdExceptionTransform: IExceptionTran { private const string ExpectedMessage = "duplicate key value violates unique constraint \"pk_mt_events_stream_and_version\""; + + private const string ExpectedMessageForArchivedStreamParitioning = + "duplicate key value violates unique constraint \"mt_events_default_stream_id_version_is_archived_idx\""; + private const string DetailsRedactedMessage = "Detail redacted as it may contain sensitive data. " + "Specify 'Include Error Detail' in the connection string to include this information."; @@ -69,6 +73,6 @@ private static bool Matches(Exception e) { return e is PostgresException pe && pe.SqlState == PostgresErrorCodes.UniqueViolation - && pe.Message.Contains(ExpectedMessage); + && (pe.Message.Contains(ExpectedMessage) || pe.Message.Contains(ExpectedMessageForArchivedStreamParitioning)); } }