Function mapErr

  • Map Err result to new error

    Type Parameters

    • E

      The error type of the Err result.

    • U

      The value type of the new Err result.

    Parameters

    • result: Result<unknown, E>

      Result to map

    • fn: (value: E) => U

      Mapping function to run on err result. The value parameter will be of type unknown.

    Returns Result<unknown, U>

    Result containing mapped error