#include <mcllib/MCExcept.h>
Inheritance diagram for MCExcept:
Public Member Functions | |
const MCSrcMsg & | getMsg () const |
Get the contained source message (where the exception originated). | |
MCExcept (const char *exStr) | |
Construct from a C-style string. | |
MCExcept (const MCSrcMsg &msg) | |
Construct from a source message. | |
virtual const char * | what () const throw () |
Method to get the text which describes the exception. | |
virtual | ~MCExcept () throw () |
Virtual destructor from std::exception. | |
Protected Member Functions | |
void | complete (const MCStringStream &mcss) |
Construct the complete exception message. | |
MCExcept () | |
Construct an exception with no message. | |
virtual void | prefix (MCStringStream &mcss) |
Prepend any prefix required by a derived exception to mcss. | |
void | setFileLine (const char *file, MCSrcMsg::linenum_t line) |
Set source file and line. | |
virtual void | suffix (MCStringStream &mcss) |
Append any suffix required by a derived exception to mcss. |
Because it is derived from std::exception, an application can catch std::exception and all library generated and system generated exceptions will be caught. If MCExcept is thrown (as opposed to MCFatalExcept), the exception is not considered by the library to be worthy of causing application termination. User-readable messages can be obtained from exceptions by calling the what() method. To allow extensions and various message manipulations, derived classes can add a prefix and/or a suffix to the original message text by over-riding the prefix() and suffix() methods.
|
Construct from a source message. Source messages are messages in the library source and indicate the file and line at which the exception occured, the exception severity etc. Using MCThrow("...") will invoke this constructor with the correct MCSrcMsg containing the file and line information.
|
|
Construct from a C-style string. In this case an MCSrcMsg is created without file and line information.
|
|
Construct the complete exception message. This method constructs the complete message from prefix() + original_text + mcss + suffix() |
|
Get the contained source message (where the exception originated).
|