Function tryingAsync

  • Execute an async block of code, catching any errors and returning them as Err.

    Type Parameters

    • T
    • E extends Error

    Parameters

    • block: Promise<T> | (() => Promise<T>)

      The block of code to execute.

    Returns Promise<Result<T, E>>

    The result of the block wrapped in an Ok, or an Err containing any error thrown by the block.