Exception Handling

Exception handling is the process of responding to the occurrence, during computation, of exceptions – anomalous or exceptional situations requiring special processing – often changing the normal flow of program execution. It is provided by specialized programming language constructs or computer hardware mechanisms.

In general, an exception is handled (resolved) by saving the current state of execution in a predefined place and switching the execution to a specific subroutine known as an exception handler. If exceptions are continuable, the handler may later resume the execution at the original location using the saved information. For example, a floating point divide by zero exception will typically, by default, allow the program to be resumed, while an out of memory condition might not be resolvable transparently.

Alternative approaches to exception handling in software are error checking, which maintains normal program flow with later explicit checks for contingencies reported using special return values or some auxiliary global variable such as C's errno or floating point status flags; or input validation to preemptively filter exceptional cases.

Read more about Exception Handling:  Exception Handling in Hardware, Exception Handling in Software

Famous quotes containing the words exception and/or handling:

    There are two great rules in life, the one general and the other particular. The first is that every one can in the end get what he wants if he only tries. This is the general rule. The particular rule is that every individual is more or less of an exception to the general rule.
    Samuel Butler (1835–1902)

    Mothers risk alienating their mates if they expect them to hold or care for the baby exactly as they do. Fathers who are constantly criticized or corrected may lose interest in handling the baby, and this is a loss for everyone. The cycle is a dangerous one. Now the same mother feels bitter because she is no longer getting any help at home.
    Cathy Rindner Tempelsman (20th century)