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. | |
static void | setGlobalErrorInfoContextPrefix (const char *cpszContextPrefix) |
Static method: set the error info context prefix. Default is" "\n While: " . | |
static const char * | getGlobalErrorInfoContextPrefix () |
Static method: retrieve the error info context prefix. | |
static void | setGlobalErrorInfoIndent (const char *cpszIndent) |
Static method: set the error info indent. Default is the empty string. | |
static const char * | getGlobalErrorInfoIndent () |
Static method: retrieve the exception context prefix. |
uima::ErrorInfo::ErrorInfo | ( | const ErrorMessage & | rclMessage, | |
TyErrorId | ulErrorId, | |||
EnSeverity | enSeverity | |||
) |
Constructor.
rclMessage | Message id describing what went wrong. | |
ulErrorId | Error number. | |
enSeverity | Recoverability info. |
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").
uima::ErrorInfo::ErrorInfo | ( | void | ) |
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.
virtual uima::ErrorInfo::~ErrorInfo | ( | ) | [virtual] |
Destructor.
const ErrorMessage& uima::ErrorInfo::getMessage | ( | void | ) | const [inline] |
Accessor for exception message.
void uima::ErrorInfo::setMessage | ( | const ErrorMessage & | rclMessage | ) | [inline] |
Accessor for exception message.
bool uima::ErrorInfo::isRecoverable | ( | ) | const [inline, virtual] |
void uima::ErrorInfo::setSeverity | ( | EnSeverity | enSeverity | ) | [inline] |
Accessor for exception severity.
TyErrorId uima::ErrorInfo::getErrorId | ( | void | ) | const [inline] |
Accessor for error numbers: query.
void uima::ErrorInfo::setErrorId | ( | TyErrorId | ulErrorId | ) | [inline] |
Accessor for error numbers.
virtual void uima::ErrorInfo::addContext | ( | const ErrorContext & | crclContext | ) | [virtual] |
Accessor for contexts: add.
size_t uima::ErrorInfo::contextCount | ( | ) | const [inline] |
Accessor for contexts: query number.
const ErrorContext* uima::ErrorInfo::contextPtrAtIndex | ( | size_t | uiContextIndex | ) | const |
Accessor for contexts: query a specific context.
std::string uima::ErrorInfo::asString | ( | ) | const |
formatted for error output of the exception to a string
void uima::ErrorInfo::reset | ( | void | ) |
Reset method for clearing any error notifications.
void uima::ErrorInfo::setGlobalErrorInfoContextPrefix | ( | const char * | cpszContextPrefix | ) | [inline, static] |
Static method: set the error info context prefix. Default is" "\n While: "
.
const char * uima::ErrorInfo::getGlobalErrorInfoContextPrefix | ( | ) | [inline, static] |
Static method: retrieve the error info context prefix.
void uima::ErrorInfo::setGlobalErrorInfoIndent | ( | const char * | cpszIndent | ) | [inline, static] |
Static method: set the error info indent. Default is the empty string.
const char * uima::ErrorInfo::getGlobalErrorInfoIndent | ( | ) | [inline, static] |
Static method: retrieve the exception context prefix.