UNPKG

return-style

Version:

Non-intrusively convert the result of any function or promise to the user's desired style.

11 lines (10 loc) 189 B
export async function getErrorPromise<E = Error>( promise: PromiseLike<unknown> ): Promise<E | undefined> { try { await promise } catch (err: any) { return err } return }