diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100644 new mode 100755 diff --git a/src/ConductorSharp.Client/ConductorSharp.Client.csproj b/src/ConductorSharp.Client/ConductorSharp.Client.csproj index 5f4755ca..ff98cdde 100644 --- a/src/ConductorSharp.Client/ConductorSharp.Client.csproj +++ b/src/ConductorSharp.Client/ConductorSharp.Client.csproj @@ -6,7 +6,7 @@ Codaxy Codaxy ConductorSharp.Client - 4.2.0 + 4.3.0 Client library for Netflix Conductor, with some additional quality of life features. https://github.com/codaxy/conductor-sharp netflix;conductor diff --git a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj index 86cc835e..79be75fd 100644 --- a/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj +++ b/src/ConductorSharp.Engine/ConductorSharp.Engine.csproj @@ -6,7 +6,7 @@ Codaxy Codaxy ConductorSharp.Engine - 4.2.0 + 4.3.0 Client library for Netflix Conductor, with some additional quality of life features. https://github.com/codaxy/conductor-sharp netflix;conductor diff --git a/src/ConductorSharp.Engine/Model/StructuredError.cs b/src/ConductorSharp.Engine/Model/StructuredError.cs index e61bbeae..b712a37d 100644 --- a/src/ConductorSharp.Engine/Model/StructuredError.cs +++ b/src/ConductorSharp.Engine/Model/StructuredError.cs @@ -19,10 +19,11 @@ public class StructuredError public string Reason { get; set; } /// - /// Optional diagnostic detail, longer and more specific than — the explanation an - /// operator needs, kept out of so that stays short and stable. Null when the producer - /// supplied nothing distinct from the reason, in which case it is omitted from serialized output - /// (NullValueHandling.Ignore) and the payload is unchanged from before this field existed. + /// Diagnostic detail, longer and more specific than — the explanation an + /// operator needs, kept out of so that stays short and stable. Mirrors + /// , which falls back to the reason when the thrower supplied no + /// distinct detail — so on the exception path the field is always populated, and consumers can + /// read it without a reason fallback of their own. /// public string Message { get; set; } @@ -47,9 +48,7 @@ public static StructuredError FromException(Exception exception) { Code = structuredException.Code, Reason = structuredException.Reason, - // Exception.Message falls back to Reason when the thrower supplied no distinct detail, so only - // carry it when it actually adds something. Existing call sites keep their exact payload. - Message = structuredException.Message == structuredException.Reason ? null : structuredException.Message, + Message = structuredException.Message, ReferenceError = structuredException.ReferenceError }; } diff --git a/src/ConductorSharp.KafkaCancellationNotifier/ConductorSharp.KafkaCancellationNotifier.csproj b/src/ConductorSharp.KafkaCancellationNotifier/ConductorSharp.KafkaCancellationNotifier.csproj index fd0d8abd..65f92081 100644 --- a/src/ConductorSharp.KafkaCancellationNotifier/ConductorSharp.KafkaCancellationNotifier.csproj +++ b/src/ConductorSharp.KafkaCancellationNotifier/ConductorSharp.KafkaCancellationNotifier.csproj @@ -4,7 +4,7 @@ net6.0 enable enable - 4.2.0 + 4.3.0 Codaxy Codaxy diff --git a/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj b/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj index c186b85b..c93109dd 100644 --- a/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj +++ b/src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj @@ -7,7 +7,7 @@ False Codaxy Codaxy - 4.2.0 + 4.3.0 diff --git a/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj b/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj index f7e33f3f..8ccaa368 100644 --- a/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj +++ b/src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj @@ -7,7 +7,7 @@ disable true dotnet-conductorsharp - 4.2.0 + 4.3.0 diff --git a/test/ConductorSharp.Engine.Tests/Unit/StructuredErrorTests.cs b/test/ConductorSharp.Engine.Tests/Unit/StructuredErrorTests.cs index c4ab097a..83a710a5 100644 --- a/test/ConductorSharp.Engine.Tests/Unit/StructuredErrorTests.cs +++ b/test/ConductorSharp.Engine.Tests/Unit/StructuredErrorTests.cs @@ -84,26 +84,27 @@ public void Message_reaches_error_message_and_reason_for_incompletion() } [Fact] - public void Message_is_omitted_when_no_message_was_supplied() + public void Message_falls_back_to_the_reason_when_no_message_was_supplied() { - // Guards the backward-compatibility promise: pre-existing call sites must keep their exact payload. + // Exception.Message defaults to the reason, and the payload always carries it — consumers read + // message without needing a reason fallback of their own. var structured = StructuredErrorOf( SerializeCatchOutput(new StructuredErrorException("CODE", "Short reason", "https://example.org/entity/1")) ); - Assert.Null(structured["message"]); + Assert.Equal("Short reason", (string)structured["message"]); Assert.Equal( - new[] { "code", "reason", "reference_error", "version" }, + new[] { "code", "message", "reason", "reference_error", "version" }, ((JObject)structured).Properties().Select(p => p.Name).OrderBy(n => n) ); } [Fact] - public void Message_is_omitted_when_it_only_repeats_the_reason() + public void Message_repeating_the_reason_is_still_carried() { var exception = new StructuredErrorException("CODE", "Same text", null, "Same text"); - Assert.Null(StructuredErrorOf(SerializeCatchOutput(exception))["message"]); + Assert.Equal("Same text", (string)StructuredErrorOf(SerializeCatchOutput(exception))["message"]); } [Fact]