EpcTools
An event based multi-threaded C++ development framework.
|
Go to the documentation of this file.
18 #ifndef __eerror_h_included
19 #define __eerror_h_included
39 #define DECLARE_ERR_MAP(__name__) EErrorMapEntry __name__[];
40 #define BGN_ERR_MAP(__name__) EErrorMapEntry __name__[] = {
42 #define ERR_MAP_ENTRY(id, err) {id, err},
44 #define END_ERR_MAP() \
53 #define DECLARE_ERROR(__e__) \
54 class __e__ : public EError \
56 virtual const cpStr Name() const { return #__e__; } \
58 #define DECLARE_ERROR_ADVANCED(__e__) \
60 class __e__ : public EError \
64 virtual const cpStr Name() const { return #__e__; } \
66 #define DECLARE_ERROR_ADVANCED2(__e__) \
68 class __e__ : public EError \
72 virtual const cpStr Name() const { return #__e__; } \
74 #define DECLARE_ERROR_ADVANCED3(__e__) \
76 class __e__ : public EError \
79 __e__(Int err, cpChar msg); \
80 virtual const cpStr Name() const { return #__e__; } \
82 #define DECLARE_ERROR_ADVANCED4(__e__) \
84 class __e__ : public EError \
88 virtual const cpStr Name() const { return #__e__; } \
171 operator cpStr() {
return m_str.c_str(); }
177 m_str.assign(val.m_str);
189 virtual const cpStr
Name()
const
208 m_str.assign(pszText);
214 Void
setTextf(cpStr pszFormat, ...);
219 m_str.append(pszText);
296 return m_pszSeverity[eSeverity];
316 static cpStr
getError(Int nError, EErrorMapEntry *pErrors);
320 virtual const char*
what()
const throw ()
322 return m_str.c_str();
327 static cpStr m_pszSeverity[];
334 #endif // #define __eerror_h_included
Void setTextf(cpStr pszFormat,...)
Sets the text associated with this error.
Definition: eerror.cpp:29
Severity
Error severity levels.
Definition: eerror.h:96
EError(Severity eSeverity, Dword err, cpStr pszText=NULL)
Additonal constructor.
Definition: eerror.h:131
EError(Severity eSeverity, const std::string &txt)
Additonal constructor.
Definition: eerror.h:141
Severity m_eSeverity
Represents the severity of the error.
Definition: eerror.h:108
Bool isSevere()
Returns True if the severity is "Error".
Definition: eerror.h:251
EError(Severity eSeverity, Dword err, const std::string &txt)
Additonal constructor.
Definition: eerror.h:151
static cpStr getSeverityText(Severity eSeverity)
Returns the text asociated with the specified severity code.
Definition: eerror.h:294
Informational.
Definition: eerror.h:99
Bool isErrorOrWarning()
Returns True if the severity is "Error" or "Warning".
Definition: eerror.h:275
Dword m_dwError
The unsigned long error code (if appropriate)
Definition: eerror.h:106
Void clear()
Clears the current contents of this error object.
Definition: eerror.h:194
cpStr getText()
Returns the text associated with this error.
Definition: eerror.h:200
Bool isInfo()
Returns True if the severity is "Info".
Definition: eerror.h:263
Bool isError()
Returns True if the severity is "Error".
Definition: eerror.h:269
Severity getSeverity()
Returns the current severity setting of this error object.
Definition: eerror.h:281
Void setText(cpStr pszText)
Sets the text associated with this error.
Definition: eerror.h:206
EError(const EError &val)
Copy constructor.
Definition: eerror.h:158
virtual const cpStr Name() const
Returns the name of this object.
Definition: eerror.h:189
Void setInfo()
Sets the severity level of this error object to "Info".
Definition: eerror.h:245
Dword getLastOsError()
Returns the current value of m_dwError.
Definition: eerror.h:301
Void appendTextf(cpStr pszText,...)
appends the specified text to the current error text using a printf style format string and parameter...
Definition: eerror.cpp:38
Void setSeverity(Severity eSeverity)
Sets the severity level of this error object.
Definition: eerror.h:230
Void setSevere()
Sets the severity level of this error object to "Error".
Definition: eerror.h:235
Bool isWarning()
Returns True if the severity is "Warning".
Definition: eerror.h:257
Void appendLastOsError(Dword dwError=-1)
Sets the value of m_dwError and appends the text description of the error to the current error text.
Definition: eerror.cpp:53
Void appendText(cpStr pszText)
appends the specified text to the current text of this error.
Definition: eerror.h:217
EError(Severity eSeverity, cpStr pszText=NULL)
Additonal constructor.
Definition: eerror.h:120
EError & copy(const EError &val)
Copies the contents of the specified object to this object.
Definition: eerror.h:175
String class.
Definition: estring.h:30
Void setWarning()
Sets the severity level of this error object to "Warning".
Definition: eerror.h:240
The base class for exceptions derived from std::exception.
Definition: eerror.h:92
virtual const char * what() const
The overloaded definition of the std::exception::what() method.
Definition: eerror.h:320
Warning.
Definition: eerror.h:101
Encapsulates and extends a std::string object.
EError & operator=(const EError &val)
Assignment operator.
Definition: eerror.h:165
Error.
Definition: eerror.h:103
EError()
Default constructor.
Definition: eerror.h:112
Void setLastOsError(Dword dwError=-1)
Sets the value of m_dwError.
Definition: eerror.cpp:47
cpStr getSeverityText()
Returns the text based on the current error object's severity.
Definition: eerror.h:287
static cpStr getError(Int nError, EErrorMapEntry *pErrors)
Returns a description for the specified application error code.
Definition: eerror.cpp:63