EMZETT.
Login

Exception handling

In short: Exception handling means catching runtime errors and dealing with them in a controlled way instead of letting the program crash. The error is “thrown” as an object and “caught” at a suitable place.

In more detail: Normal code and error handling are kept apart. When something goes wrong (file missing, index too large, network gone), an exception is raised. It travels up the call stack until a matching handler deals with it. If nobody catches it, the program ends with an error message and a stack trace.

In detail

See also: Exceptions, Multiple exceptions