Transforms the failure value, passing successes through unchanged.
Preserves cancelled: mapping an error must not silently turn a cancellation into a failure. If fn throws, that exception propagates; it is not wrapped in a Result.
cancelled
fn
Result
const wrapped = mapResultErr(result, (cause) => userError({ code: 'X', message: 'Failed.', cause })); Copy
const wrapped = mapResultErr(result, (cause) => userError({ code: 'X', message: 'Failed.', cause }));
Transforms the failure value, passing successes through unchanged.
Preserves
cancelled: mapping an error must not silently turn a cancellation into a failure. Iffnthrows, that exception propagates; it is not wrapped in aResult.