Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .husky/pre-commit
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/ConductorSharp.Client/ConductorSharp.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Authors>Codaxy</Authors>
<Company>Codaxy</Company>
<PackageId>ConductorSharp.Client</PackageId>
<Version>4.2.0</Version>
<Version>4.3.0</Version>
<Description>Client library for Netflix Conductor, with some additional quality of life features.</Description>
<RepositoryUrl>https://github.com/codaxy/conductor-sharp</RepositoryUrl>
<PackageTags>netflix;conductor</PackageTags>
Expand Down
2 changes: 1 addition & 1 deletion src/ConductorSharp.Engine/ConductorSharp.Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Authors>Codaxy</Authors>
<Company>Codaxy</Company>
<PackageId>ConductorSharp.Engine</PackageId>
<Version>4.2.0</Version>
<Version>4.3.0</Version>
<Description>Client library for Netflix Conductor, with some additional quality of life features.</Description>
<RepositoryUrl>https://github.com/codaxy/conductor-sharp</RepositoryUrl>
<PackageTags>netflix;conductor</PackageTags>
Expand Down
13 changes: 6 additions & 7 deletions src/ConductorSharp.Engine/Model/StructuredError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ public class StructuredError
public string Reason { get; set; }

/// <summary>
/// Optional diagnostic detail, longer and more specific than <see cref="Reason"/> — the explanation an
/// operator needs, kept out of <see cref="Reason"/> 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 <see cref="Reason"/> — the explanation an
/// operator needs, kept out of <see cref="Reason"/> so that stays short and stable. Mirrors
/// <see cref="Exception.Message"/>, 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.
/// </summary>
public string Message { get; set; }

Expand All @@ -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
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>4.2.0</Version>
<Version>4.3.0</Version>
<Authors>Codaxy</Authors>
<Company>Codaxy</Company>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ConductorSharp.Patterns/ConductorSharp.Patterns.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Authors>Codaxy</Authors>
<Company>Codaxy</Company>
<Version>4.2.0</Version>
<Version>4.3.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Nullable>disable</Nullable>
<PackAsTool>true</PackAsTool>
<ToolCommandName>dotnet-conductorsharp</ToolCommandName>
<Version>4.2.0</Version>
<Version>4.3.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
13 changes: 7 additions & 6 deletions test/ConductorSharp.Engine.Tests/Unit/StructuredErrorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading