Cell API
    Preparing search index...

    Function withAsyncBody

    • A helper to create a new Promise<T> with a body that is a promise itself. By default, an error that raises from the async body will end up as a unhandled rejection, so this utility properly awaits the body and rejects the promise as a normal promise does without async body.

      This method should only be used in rare cases where otherwise async cannot be used (e.g. when callbacks are involved that require this).

      Type Parameters

      • T
      • E = Error

      Parameters

      • bodyFn: (
            resolve: (value: T) => unknown,
            reject: (error: E) => unknown,
        ) => Promise<unknown>

      Returns Promise<T>