MLIB
|
Unified error handling. More...
Data Structures | |
class | mlib::errfac |
An error facility routes a group of errors handled in a similar manner. More... | |
class | mlib::erc |
objects returned as a function result or thrown directly. More... | |
Unified error handling.
erc objects are a cross between exceptions and return values. A function can return an erc object and the caller can check it just like a regular return value as in this example:
However with ercs, if the return result is not checked, it might be thrown as an exception as in the following example.
This dual behavior is obtained by having erc objects throwing an exception in their destructor if the object is "active". An object is marked as "inactive" every time the integer conversion operator is invoked like in the first example.