#include <ivderror.h>


It defines basic architecture for exceptions. This class can not be thrown. Use this class in catch, when you want to catch all of the classes from the whole group.
Its derived classes provide additional functionality.
Derived classes define their own constructors and overload GetErrorText() to supply proper m_error to m_errorText translation.
Derived classes must call FormatText() member function to initialise the ivd_Exception::m_formatted member.
If a_logError == true is specified in construction, then an error log is generated (log_ERR_m). Otherwise, FormatText() function tries to get any useful information from stack and append it to the exception text.
An example of a derived class:
class ivd_SpecialException : ivd_Exception {
public:
ivd_SpecialException(
const int a_ivdErr,
const string &a_context = "",
bool a_logError = false);
virtual ~ivd_SpecialException();
protected:
virtual string GetErrorText();
private:
log_CLASSID_m;
}
ivd_SpecialException(
const int a_ivdErr,
const string &a_context = "",
bool a_logError = false);
ivd_SpecialException::ivd_SpecialException(
const int a_ivdErr, const string &a_context, bool a_logError)
: ivd_Exception(a_ivdErr, a_context, false) {
m_log = a_log_Error;
FormatText(s_className);
// Do some more processing if necessary.
}
string ivd_SpecialException::GetErrorText() {
return ivd_GetSpecialErrorText(m_error);
}
Note that constructor calls FormatText() with its class name as identifier and overloaded GetErrorText() member function, which provides a string representation of an error code (ivd_Exception::m_error member).
Definition at line 111 of file ivderror.h.
Public Member Functions | |
| virtual | ~ivd_Exception () throw () |
Protected Member Functions | |
| ivd_Exception (const int a_err, const string &a_context, bool a_logError) throw () | |
| ivd_Exception (const int a_err, const string &a_context, const string &a_detailed, bool a_logError) throw () | |
Private Attributes | |
| log_CLASSID_m | |
| virtual ivd_Exception::~ivd_Exception | ( | ) | throw () [inline, virtual] |
| ivd_Exception::ivd_Exception | ( | const int | a_err, | |
| const string & | a_context, | |||
| bool | a_logError | |||
| ) | throw () [inline, protected] |
Definition at line 119 of file ivderror.h.
00123 : 00124 ivd_BaseException(a_err, a_context, a_logError) { 00125 // Empty 00126 };
| ivd_Exception::ivd_Exception | ( | const int | a_err, | |
| const string & | a_context, | |||
| const string & | a_detailed, | |||
| bool | a_logError | |||
| ) | throw () [inline, protected] |
Definition at line 128 of file ivderror.h.
00133 : 00134 ivd_BaseException(a_err, a_context, a_detailed, a_logError) { 00135 // Empty 00136 };
ivd_Exception::log_CLASSID_m [private] |
Reimplemented from ivd_BaseException.
Reimplemented in ivd_SysError, ivd_Error, ivd_DFError, and ivd_DBException.
Definition at line 136 of file ivderror.h.
1.5.6