Error Handling
throw creates an error. try/catch recovers. In async functions, failed awaits reject into catch.
- throw new Error("message")
- finally always runs.
- Do not swallow errors silently.
try {
throw new Error("boom");
} catch (err) {
console.log(err.message);
}
After you read this chapter, use Write (when available) and Quiz on this page to lock it in.