Summary
Ship a behavior that translates or wraps an exception from the target. Swallowing a failure is a separate, off-by-default option.
API
The map is Func<Exception, Exception?>. Null means leave the exception as it is. Any other instance replaces it. A separate switch, default off, lets the map turn a failure into a successful value.
Behavior
- Observe both failure channels through
Proceed: a synchronous throw, and a faulted Task or ValueTask.
- A wrapped exception keeps the original as
InnerException.
- A translated synchronous exception is still thrown by the stunt. A translated task fault remains a fault of the returned awaitable, with
IMethodReturn.Exception null.
- Exceptions thrown by behaviors outside this one are left alone.
Acceptance
- An
IOException from the target becomes the mapped exception, and the original is its inner exception.
- Awaiting a faulted
Task<T> throws the mapped exception.
- With swallowing left off, the map cannot turn a failure into a value.


Summary
Ship a behavior that translates or wraps an exception from the target. Swallowing a failure is a separate, off-by-default option.
API
The map is
Func<Exception, Exception?>. Null means leave the exception as it is. Any other instance replaces it. A separate switch, default off, lets the map turn a failure into a successful value.Behavior
Proceed: a synchronous throw, and a faultedTaskorValueTask.InnerException.IMethodReturn.Exceptionnull.Acceptance
IOExceptionfrom the target becomes the mapped exception, and the original is its inner exception.Task<T>throws the mapped exception.