From a4d618bfbd93b0cdd12e77d8a822c4485909b058 Mon Sep 17 00:00:00 2001 From: Eric Bowden Date: Fri, 1 May 2026 10:28:21 -0500 Subject: [PATCH] Added a constructor AgentTerminationException that takes another exception so root causes can be preserved; used it for STORAGE_SPACE failures --- src/Adaptive.Agrona/Concurrent/AgentTerminationException.cs | 4 ++++ src/Adaptive.Cluster/Service/ClusteredServiceAgent.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Adaptive.Agrona/Concurrent/AgentTerminationException.cs b/src/Adaptive.Agrona/Concurrent/AgentTerminationException.cs index c7cbca79..e6350e31 100644 --- a/src/Adaptive.Agrona/Concurrent/AgentTerminationException.cs +++ b/src/Adaptive.Agrona/Concurrent/AgentTerminationException.cs @@ -11,5 +11,9 @@ public AgentTerminationException() public AgentTerminationException(string message) : base(message) { } + + public AgentTerminationException(Exception innerException) : base(innerException?.ToString(), innerException) + { + } } } \ No newline at end of file diff --git a/src/Adaptive.Cluster/Service/ClusteredServiceAgent.cs b/src/Adaptive.Cluster/Service/ClusteredServiceAgent.cs index 2bafa2db..394a0d23 100644 --- a/src/Adaptive.Cluster/Service/ClusteredServiceAgent.cs +++ b/src/Adaptive.Cluster/Service/ClusteredServiceAgent.cs @@ -906,7 +906,7 @@ private long OnTakeSnapshot(long logPosition, long leadershipTermId) { if (ex.ErrorCode == ArchiveException.STORAGE_SPACE) { - throw new AgentTerminationException(); + throw new AgentTerminationException(ex); } throw;