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).
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
asynccannot be used (e.g. when callbacks are involved that require this).