• Unwraps the Err value from a Result, or throws an error.

    Type Parameters

    • E

    • T

    Parameters

    • res: Result<E, T>

      The value which should be an Err.

    Returns E

    The unwrapped item.

    Examples

    import { err, ok, unwrapErr } from "./result.ts";
    import { assertEquals, assertThrows } from "../deps.ts";

    assertThrows(() => unwrapErr(ok(3)), "unwrapped Ok");
    assertEquals(unwrapErr(err(4)), 4);

Generated using TypeDoc