@praha/byethrow
    Preparing search index...

    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.

    The input Result or ResultAsync.

    The return type of the inspection function.

    import { Result } from '@praha/byethrow';

    const result = Result.pipe(
    Result.fail('error'),
    Result.inspectError((error) => console.log('Debug error:', error)),
    );
    // Console output: "Debug error: error"
    // Result: { type: 'Failure', error: 'error' }
    import { Result } from '@praha/byethrow';

    const result = Result.pipe(
    Result.succeed(42),
    Result.inspectError((error) => console.log('Debug error:', error)),
    );
    // No console output
    // Result: { type: 'Success', value: 42 }

    pipe - It is recommended to use this function with the pipe function for better readability and composability.