• Wraps a promise to catch errors and return a Result tuple. This allows for cleaner error handling without try-catch blocks.

    Returns

    A tuple of [error, null] on failure or [null, data] on success

    Type Parameters

    • T

    • E = Error

    Parameters

    • promise: Promise<T>

      The promise to wrap

    Returns Promise<Result<T, E>>