ErrorInfo
: This is the base class for all error information used in UIMACPP.
An error info has a text, that is supposed to be a simple description of the error with out context (e.g. "Could not open file") and error number an error code groups and an error severity (recoverable or unrecoverable). To this basic information a LIST of error contexts can be added (a context has a text and a location, see class ErrorContext
above).
This class is the main informational part in an Exception
. But can be also used outside of exceptions in the case where you need to return detailed error information. For this second use we need the public setxxx methods for message, errorid and severity. The setxxx functions should not be used for ErrorInfo
objects inside exceptions.
Public Types | |
enum | EnSeverity { unrecoverable, recoverable } |
enum used to specify severity More... | |
Public Member Functions | |
ErrorInfo (const ErrorMessage &rclMessage, TyErrorId ulErrorId, EnSeverity enSeverity) | |
Constructor. | |
ErrorInfo (void) | |
Default Constructor (use outside exceptions only!). | |
virtual | ~ErrorInfo () |
Destructor. | |
const ErrorMessage & | getMessage (void) const |
Accessor for exception message. | |
void | setMessage (const ErrorMessage &rclMessage) |
Accessor for exception message. | |
virtual bool | isRecoverable () const |
Accessor for exception severity: query. | |
void | setSeverity (EnSeverity enSeverity) |
Accessor for exception severity. | |
TyErrorId | getErrorId () const |
Accessor for error numbers: query. | |
void | setErrorId (TyErrorId ulErrorId) |
Accessor for error numbers. | |
virtual void | addContext (const ErrorContext &crclContext) |
Accessor for contexts: add. | |
size_t | contextCount () const |
Accessor for contexts: query number. | |
const ErrorContext * | contextPtrAtIndex (size_t uiContextIndex) const |
Accessor for contexts: query a specific context. | |
std::string | asString () const |
formatted for error output of the exception to a string | |
void | reset (void) |
Reset method for clearing any error notifications. | |
Static Public Member Functions | |
Static methods. | |
The following static methods can be called on the ErrorInfo class directly. | |
void | setGlobalErrorInfoContextPrefix (const char *cpszContextPrefix) |
Static method: set the error info context prefix. Default is" "\n While: " . | |
const char * | getGlobalErrorInfoContextPrefix () |
Static method: retrieve the error info context prefix. | |
void | setGlobalErrorInfoIndent (const char *cpszIndent) |
Static method: set the error info indent. Default is the empty string. | |
const char * | getGlobalErrorInfoIndent () |
Static method: retrieve the exception context prefix. |
|
enum used to specify severity
|
|
Constructor.
clMessage parameter should just state the plain info what went wrong (e.g. "Could not open file X"). Use an exception context to add information why, how it went wrong (e.g. "While trying to open application ini-file"). |
|
Default Constructor (use outside exceptions only!). For uses of class ErrorInfo ouside exceptions you will want to define an empty (neutral, no error) ErrorInfo object which might get filled with error information by failing functions. This default constructor will create such a no-error ErrorInfo object for you. |
|
Destructor.
|
|
Accessor for exception message.
|
|
Accessor for exception message.
|
|
Accessor for exception severity: query.
|
|
Accessor for exception severity.
|
|
Accessor for error numbers: query.
|
|
Accessor for error numbers.
|
|
Accessor for contexts: add.
|
|
Accessor for contexts: query number.
|
|
Accessor for contexts: query a specific context.
|
|
formatted for error output of the exception to a string
|
|
Reset method for clearing any error notifications.
|
|
Static method: set the error info context prefix. Default is"
|
|
Static method: retrieve the error info context prefix.
|
|
Static method: set the error info indent. Default is the empty string.
|
|
Static method: retrieve the exception context prefix.
|