1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#ifndef ABRTEXCEPTION_H_
#define ABRTEXCEPTION_H_
#include <string>
typedef enum {
EXCEP_UNKNOW,
EXCEP_DD_OPEN,
EXCEP_DD_LOAD,
EXCEP_DD_SAVE,
EXCEP_DD_DELETE,
EXCEP_DL,
EXCEP_PLUGIN,
EXCEP_ERROR,
EXCEP_FATAL,
} abrt_exception_t;
/* std::exception is a class with virtual members.
* deriving from it makes our ctor/dtor much more heavy,
* and those are inlined in every throw and catch site!
*/
class CABRTException /*: public std::exception*/
{
private:
std::string m_sWhat;
abrt_exception_t m_Type;
public:
/* virtual ~CABRTException() throw() {} */
CABRTException(abrt_exception_t pType, const char* pWhat) :
m_sWhat(pWhat),
m_Type(pType)
{}
CABRTException(abrt_exception_t pType, const std::string& pWhat) :
m_sWhat(pWhat),
m_Type(pType)
{}
abrt_exception_t type() { return m_Type; }
const char* what() const { return m_sWhat.c_str(); }
};
#endif
|