Function trys

  • Calls the given function, catches any thrown error into an Err, and wraps the returned value with an Ok if nothing goes wrong.

    Type Parameters

    • T

    Parameters

    • fn: (() => T)
        • (): T
        • Returns T

    Returns Result<T, unknown>

  • Parameters

    • fn: (() => void)
        • (): void
        • Returns void

    Returns Result<void, unknown>