Transform the error channel of a ResultAsync. fn may return a value or a Promise. Success values pass through untouched.
fn
Promise
Dual API — works data-first or curried for use in pipe.
pipe
pipe( fetchUser(id), ResultAsync.mapError(cause => ({ code: "USER_LOAD_FAILED", cause })), ) Copy
pipe( fetchUser(id), ResultAsync.mapError(cause => ({ code: "USER_LOAD_FAILED", cause })), )
Transform the error channel of a ResultAsync.
fnmay return a value or aPromise. Success values pass through untouched.Dual API — works data-first or curried for use in
pipe.