Errors and Recovery
Define failure contracts, throw useful error types, preserve causes, and recover only where the application can act.
Lesson introduction
Errors are part of an interface contract. Code should distinguish invalid caller input, unavailable resources, cancellation, and unexpected defects so each layer can respond honestly.
Where this fits
This lesson builds one part of the path from language fundamentals to complete browser applications.
What you will build
Design typed validation errors and an application boundary that maps them to useful, safe messages.
You will first study the underlying rule, then trace worked code, repair a mistake, and create an independent solution.