method Result.prototype.inspectErr
Result.prototype.inspectErr(fn: (error: E) => void): Result<T, E>

Performs a side effect on the Err value without changing the Result.

Examples

Example 1

const result = fetchUser("123")
  .inspectErr(error => console.error("Failed:", error))
  .map(user => user.name);

Parameters

fn: (error: E) => void

Function to call with the error value (if Err)

Return Type

This Result, unchanged

Usage

import { Result } from "result/mod.ts";