Function: inspectError()
Executes a side effect function on the error value of a Result or ResultAsync, without modifying the original result. This is useful for debugging, logging, or performing other side effects while maintaining the original value and error state.
Type Param
R1
The input Result or ResultAsync.
Type Param
R2
The return type of the inspection function.
Examples
Failure Case
Success Case
See
pipe - It is recommended to use this function with the pipe function for better readability and composability.
Call Signature
inspectError<
R1,R2>(fn): (result) =>ResultFor<R1|R2,InferSuccess<R1>,InferFailure<R1>>
Type Parameters
R1
R1 extends ResultMaybeAsync<any, any>
R2
R2
Parameters
fn
(a) => R2
Returns
(result) => ResultFor<R1 | R2, InferSuccess<R1>, InferFailure<R1>>
Call Signature
inspectError<
F>(fn): <R1>(result) =>ResultFor<R1|ReturnType<F>,InferSuccess<R1>,InferFailure<R1>>
Type Parameters
F
F extends (a) => unknown
Parameters
fn
F
Returns
<R1>(result) => ResultFor<R1 | ReturnType<F>, InferSuccess<R1>, InferFailure<R1>>
