JS Built-ins
AsyncPatternsintermediate

async function returns Promise even with throw

πŸ“– Usage Example
async function risky() { throw new Error('oops'); }
risky() instanceof Promise; // true

An async function that throws still returns a Promise β€” a rejected one.

Async Error Handling

An async function that throws still returns a Promise (a rejected one).

Challenge: Verify that an async function throwing still returns a Promise.

πŸ’‘ Hints (3)
  • β€’ Async functions always return Promises.
  • β€’ Throwing in an async function creates a rejected Promise.
  • β€’ Error handling with try/catch still returns a Promise.