Exception (error handling)
Applies to: general, python, cpp
An exception signals an error that interrupts normal flow; you raise/throw it and catch/handle it
elsewhere with try/except (Python) or try/catch (C++). It separates error handling from the main logic.
try:
x = int(s)
except ValueError:
x = 0 # handle bad input
See also: function