English
Summary
Conclusions
Place a handler where it can provide a meaningful response. Check preconditions before changing state, close resources automatically, and preserve the cause when converting an exception.
Self-check questions
- How do checked and unchecked exceptions differ?
- Why must a catch for a subtype precede one for a supertype?
- Which types can be combined using multi-catch?
- How does throw differ from throws?
- Why is finally not guaranteed when a process crashes?
- Why is a return in finally dangerous?
- How do you preserve an exception's original cause?
- In what order are resources closed?
- How does suppressed differ from cause?
- Why does assert not reliably validate user input?
- What state should you inspect for an error in an average?
- How do you verify that state remains unchanged after a failure?