InterviewBuddy
All interview questions

What does async/await change about error handling?

Beginner

Answer

An async function always returns a Promise. Await unwraps a fulfilled value or throws a rejection into the surrounding async function, where try/catch can handle it.

Explanation

Await makes asynchronous control flow easier to read, but it does not make independent operations parallel unless they are started before awaiting.

Example

try { const user = await loadUser(); } catch (error) { /* handle */ }