What happens if an error is thrown by an 'await' operation and not caught?

Responsive Ad Header

Question

Grade: Education Subject: Support
What happens if an error is thrown by an 'await' operation and not caught?
Asked by:
74 Viewed 74 Answers

Answer (74)

Best Answer
(318)
If an error is thrown by an 'await' operation and not caught by a 'try...catch' block, it will typically result in an unhandled rejection. In Node.js, this might lead to the process crashing unless specific global error handlers are set up. In browsers, it might manifest as an uncaught error in the developer console.