English
Topic 4. Exception handling, the Result type, and program debugging
Goal: learn to define error contracts, use try/catch and Result, preserve state after a failed operation, and inspect an error's cause in the debugger.
Lecture contents
- Exceptions and try–catch — Errors and their observable behavior · The Throwable hierarchy on the JVM · try, catch, and finally
- try/throw expressions and preconditions — try and throw as expressions · Preconditions with require and state checks with check
- Result and resources — Choosing between null, exceptions, and Result · Transforming Result and errors in handlers · Resources and use
- Stack traces and the debugger — Stack traces and causes · The IntelliJ IDEA debugger
- Logic errors and exit codes — Example 4. A logic error in an average · Exit codes and the application boundary · Final checks