Exception handling
A programming mechanism for gracefully responding to errors and abnormal conditions using try-catch-finally blocks. Exception handling prevents programs from crashing when errors occur, allowing recovery or clean shutdown. Exceptions are objects representing errors, with specific types for different error categories. Proper exception handling improves program robustness and user experience.
Real World
When the NHS COVID-19 booking website couldn't connect to its database, exception handling displayed a friendly 'Service temporarily unavailable' message instead of crashing and exposing raw error details to millions of users.
Exam Focus
Name specific exception types (e.g. FileNotFoundException) in answers — generic 'catch all errors' loses marks.
How well did you know this?