UNPKG

return-style

Version:

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

9 lines (8 loc) 154 B
export function getError<E = Error>(fn: () => unknown): E | undefined { try { fn() } catch (syncError: any) { return syncError } return }