Function resultAsync

  • Wraps an async function to catch any exceptions inside and return a Result tuple with the value and error, if any.

    Returns

    A new function that awaits the given function and returns the result tuple.

    Type Parameters

    • T = any

    • E = unknown

    Parameters

    • fn: Function<Promise<T>>

      The async function to await.

    Returns Function<Promise<Result<T, E>>>

Generated using TypeDoc