forked from treefrogframework/treefrog-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtfexception.h
130 lines (110 loc) · 4.08 KB
/
tfexception.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef TFEXCEPTION_H
#define TFEXCEPTION_H
#include <exception>
#include <QString>
#include <TGlobal>
class T_CORE_EXPORT RuntimeException : public std::exception
{
public:
RuntimeException(const RuntimeException &e)
: std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
RuntimeException(const QString &message, const char *fileName = "", int lineNumber = 0)
: msg(message), file(fileName), line(lineNumber) { }
virtual ~RuntimeException() throw() { }
QString message() const { return msg; }
QString fileName() const { return file; }
int lineNumber() const { return line; }
virtual void raise() const { throw *this; }
virtual std::exception *clone() const { return new RuntimeException(*this); }
private:
QString msg;
QString file;
int line;
};
class T_CORE_EXPORT SecurityException : public std::exception
{
public:
SecurityException(const SecurityException &e)
: std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
SecurityException(const QString &message, const char *fileName = "", int lineNumber = 0)
: msg(message), file(fileName), line(lineNumber) { }
virtual ~SecurityException() throw() { }
QString message() const { return msg; }
QString fileName() const { return file; }
int lineNumber() const { return line; }
virtual void raise() const { throw *this; }
virtual std::exception *clone() const { return new SecurityException(*this); }
private:
QString msg;
QString file;
int line;
};
class T_CORE_EXPORT SqlException : public std::exception
{
public:
SqlException(const SqlException &e)
: std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
SqlException(const QString &message, const char *fileName = "", int lineNumber = 0)
: msg(message), file(fileName), line(lineNumber) { }
virtual ~SqlException() throw() { }
QString message() const { return msg; }
QString fileName() const { return file; }
int lineNumber() const { return line; }
virtual void raise() const { throw *this; }
virtual std::exception *clone() const { return new SqlException(*this); }
private:
QString msg;
QString file;
int line;
};
class T_CORE_EXPORT KvsException : public std::exception
{
public:
KvsException(const KvsException &e)
: std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
KvsException(const QString &message, const char *fileName = "", int lineNumber = 0)
: msg(message), file(fileName), line(lineNumber) { }
virtual ~KvsException() throw() { }
QString message() const { return msg; }
QString fileName() const { return file; }
int lineNumber() const { return line; }
virtual void raise() const { throw *this; }
virtual std::exception *clone() const { return new KvsException(*this); }
private:
QString msg;
QString file;
int line;
};
class T_CORE_EXPORT ClientErrorException : public std::exception
{
public:
ClientErrorException(const ClientErrorException &e)
: std::exception(e), code(e.code) { }
ClientErrorException(int statusCode)
: code(statusCode) { }
virtual ~ClientErrorException() throw() { }
int statusCode() const { return code; }
virtual void raise() const { throw *this; }
virtual std::exception *clone() const { return new ClientErrorException(*this); }
private:
int code;
};
class T_CORE_EXPORT StandardException : public std::exception
{
public:
StandardException(const StandardException &e)
: std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
StandardException(const QString &message, const char *fileName = "", int lineNumber = 0)
: msg(message), file(fileName), line(lineNumber) { }
virtual ~StandardException() throw() { }
QString message() const { return msg; }
QString fileName() const { return file; }
int lineNumber() const { return line; }
virtual void raise() const { throw *this; }
virtual std::exception *clone() const { return new StandardException(*this); }
private:
QString msg;
QString file;
int line;
};
#endif // TFEXCEPTION_H