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
  • Parameters

    • error: unknown

      The error to escalate

    Returns never