Wraps a function to catch and re-throw any errors it throws or promise rejections out of the current execution flow.
This prevents uncaught exceptions / unhandled rejections from disrupting the current execution flow.
The function to wrap.
A new async function that wraps the original function and catches any errors thrown or promise rejections.
Wraps a function to catch and re-throw any errors it throws or promise rejections out of the current execution flow.
This prevents uncaught exceptions / unhandled rejections from disrupting the current execution flow.