Repository navigation
feat: a fault keeps the exception that caused it, for the log and never the problem - #89
Merged
Merged
Conversation
…er the problem A caught exception was lost on the way to a Fault<TFault>: the MapError that turns it into the fault an endpoint answers dropped it, so a log of the refusal could not say what failed underneath (decision 52). - Fault<TFault>.Cause, set by Fault.Of(reason, detail, cause) and the constructor of the same shape, and Of(reason, detail, cause) on Fault<T1, T2> and Fault<T1, T2, T3>. WithRule and `with` keep it. A null cause is refused where one is given. - Equality and the hash code are the reason's, the detail's and the rule's, written by hand so the cause takes no part; ToString prints as 2.2 did. - AspNetCore: FaultProblem<TFault>.Cause, and IFaultFeature.Cause as a default member, so a host's own implementation still builds. The problem's members are the same with a cause as without one. - READMEs (core, and AspNetCore's "What failed underneath" with compiled samples), changelog, the option-result note; the roadmap item goes. - The C03 seeds are regenerated against the new source. The private Problem() helper stays the composed overloads' alone, so each-error-own-set still breaks composed faults only. Proved by seeding: equality over the cause fails two tests, a dropped cause in ToHttpResult six, and the cause's message written into the problem five. Closes #84 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #84
Problem
A caught exception was lost on the way to a
Fault<TFault>. TheMapErrorthat turns it into the fault an endpoint answers dropped it, so a log of the refusal could not say what failed underneath (decision 52).Change
Fault<TFault>.Cause, set byFault.Of(reason, detail, cause)and the constructor of the same shape;Of(reason, detail, cause)onFault<T1, T2>andFault<T1, T2, T3>.WithRuleandwithkeep it; a null cause is refused. Equality and the hash code are written by hand over the reason, detail and rule, so the cause takes no part;ToString()prints as 2.2 did.FaultProblem<TFault>.Cause, andIFaultFeature.Causeas a default member, so a host's own implementation still builds. Nothing of the cause is written into the problem.FaultProblem.csandTypeKitHttpResultExtensions.csare regenerated against the new source. The privateProblem()helper stays the composed overloads' alone, soeach-error-own-setstill breaks composed faults only.Tests
FaultTests,ComposedFaultTests: the cause is kept, refused when null, kept byWithRuleandwith, and left out of equality, hashing and printing.FaultResponsePartsTests: over the fourFault<TFault>overloads and a composed one, the cause reachesIFaultFeature.Causeand the problem has exactly the members a fault without a cause writes, naming neither the exception's type nor its message.ToHttpResult(6), the cause's message written into the problem (5).prober seeds --probe C03ComposedProbe: 5 of 5 seeds caught.seeds --allbefore the tag).🤖 Generated with Claude Code