stdx::Exception Class Reference
This exception base class extends the standard library exception base class to include a string error message and stacked exceptions. Stacked exceptions allow one to catch an exception, rethrow a new exception and still maintain information about the original exception in the standard what message.
So an example error message might look like this:
EInvalidInputFile : fileparser.cc(99) : Parser::Parse() : Error parsing input file EInvalidArg : bar.cc(34) : Bar::Bar() : Could not create Bar object from string ELowLevelException : file1.cc(56) : foo() : Could convert string to int
This essentially gives a trace of three exceptions which where throw leading to the final program abort. A user can see that there was some trouble converting a string to an int (possibly in the wrong format) and as a result the program could not create an object of type Bar. Ultimately the program was trying to parse some input file and could not due to this conversion error. The key advantage to this style of nested exceptions is that it means that a programmer doesn't have to catch, decode, and come up with a new error message to rethrow a new exception. Instead we just stack exceptions together ...
- Todo:
- We probably should add support for disabling exceptions. This could be done pretty easily by adding TRY/CATCH macros and using a macro for the base class of stdx::Exception.
Inheritance diagram for stdx::Exception:

Public Methods
- Exception (const std::string &msg)
- ~Exception () throw ()
- addCausingExceptionInfo (const stdx::Exception &e)
- setReducedMessage (const std::string &msg)
- what () const throw ()
- reduced_what () const throw ()
Related Functions
(Note that these are not member functions.)- STDX_THROW(eName, descript)
- STDX_RETHROW(caughtException, eName, descript)
- STDX_ASSERT(assertion)