Utility function to escalate promise rejections into thrown errors. Used to make promises throw the errors instead of ignoring them.
The original error if it's an Error instance, or a new Error with the error message
await waitForEvent('player_join') .catch(escalate); // Will throw instead of silently failing Copy
await waitForEvent('player_join') .catch(escalate); // Will throw instead of silently failing
The error to escalate
Utility function to escalate promise rejections into thrown errors. Used to make promises throw the errors instead of ignoring them.
Throws
The original error if it's an Error instance, or a new Error with the error message
Example