JavaScript
⚠️ Error handling
Learn to anticipate, catch and throw errors to write robust programs.
What you'll learn
- Catch errors with
try/catchand run guaranteed cleanup withfinally. - Throw errors on purpose with
throw new Error(...)to validate inputs and fail fast. - Distinguish the built-in types (
TypeError,RangeError,SyntaxError) and check them withinstanceof. - Create custom errors by extending
Errorto tell them apart from system ones.
Lessons
try, catch and finallyCatch errors without stopping the program. Throwing errors with throwWhen and how to trigger an error on purpose. Error types and custom errorsError, TypeError, RangeError and your own classes.Practice this module in the app
DevPath is a hands-on course: you read the theory here; in the app you put it into practice with exercises that really run, offline.
Start free in the app →