You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fault: an optional Cause, kept for the log and never written to the problem #84
A caught exception is lost on the way to a Fault<TFault>: Result.Catch makes the exception the whole error, and the MapError that turns it into the fault an endpoint answers drops it, so a log of the refusal cannot say what failed underneath (decision 52, the roadmap's 2.3.0 section).
Proposal
An optional Exception? Cause on Fault<TFault>, set through Fault.Of(reason, detail, cause) (and the constructor), carried through WithRule and the composed Fault<T1, T2> / Fault<T1, T2, T3>.
Equality stays the reason's, the detail's and the rule's: a fault with a cause equals the same fault without one.
In AspNetCore, FaultProblem<TFault>.Cause and IFaultFeature.Cause (a default member, so a host's own implementation still builds) carry it for the log and CustomizeProblemDetails. It is never written to the problem.
The docs show MapError(e => Fault.Of(reason, detail, e)) from a Result<T, Exception>.
Done when
The cause is kept by WithRule, the composed faults and ToHttpResult(), and no problem body names the exception (type or message).
Equality and hash code ignore it; ToString() prints as 2.2 did.
Core and AspNetCore READMEs show it as compiled samples; changelog entry.
Activity
CaffeinatedCoder commentedon Oct 28, 2026
Done in PR #89, merged into release/2.3.0.