TreeFrogFramework  1.18
tfexception.h
Go to the documentation of this file.
1 #ifndef TFEXCEPTION_H
2 #define TFEXCEPTION_H
3 
4 #include <exception>
5 #include <QString>
6 #include <TGlobal>
7 
8 
9 class T_CORE_EXPORT RuntimeException : public std::exception
10 {
11 public:
13  : std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
14  RuntimeException(const QString &message, const char *fileName = "", int lineNumber = 0)
15  : msg(message), file(fileName), line(lineNumber) { }
16  virtual ~RuntimeException() throw() { }
17  QString message() const { return msg; }
18  QString fileName() const { return file; }
19  int lineNumber() const { return line; }
20  virtual void raise() const { throw *this; }
21  virtual std::exception *clone() const { return new RuntimeException(*this); }
22 
23 private:
24  QString msg;
25  QString file;
26  int line;
27 };
28 
29 
30 class T_CORE_EXPORT SecurityException : public std::exception
31 {
32 public:
34  : std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
35  SecurityException(const QString &message, const char *fileName = "", int lineNumber = 0)
36  : msg(message), file(fileName), line(lineNumber) { }
37  virtual ~SecurityException() throw() { }
38  QString message() const { return msg; }
39  QString fileName() const { return file; }
40  int lineNumber() const { return line; }
41  virtual void raise() const { throw *this; }
42  virtual std::exception *clone() const { return new SecurityException(*this); }
43 
44 private:
45  QString msg;
46  QString file;
47  int line;
48 };
49 
50 
51 class T_CORE_EXPORT SqlException : public std::exception
52 {
53 public:
55  : std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
56  SqlException(const QString &message, const char *fileName = "", int lineNumber = 0)
57  : msg(message), file(fileName), line(lineNumber) { }
58  virtual ~SqlException() throw() { }
59  QString message() const { return msg; }
60  QString fileName() const { return file; }
61  int lineNumber() const { return line; }
62  virtual void raise() const { throw *this; }
63  virtual std::exception *clone() const { return new SqlException(*this); }
64 
65 private:
66  QString msg;
67  QString file;
68  int line;
69 };
70 
71 
72 class T_CORE_EXPORT KvsException : public std::exception
73 {
74 public:
76  : std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
77  KvsException(const QString &message, const char *fileName = "", int lineNumber = 0)
78  : msg(message), file(fileName), line(lineNumber) { }
79  virtual ~KvsException() throw() { }
80  QString message() const { return msg; }
81  QString fileName() const { return file; }
82  int lineNumber() const { return line; }
83  virtual void raise() const { throw *this; }
84  virtual std::exception *clone() const { return new KvsException(*this); }
85 
86 private:
87  QString msg;
88  QString file;
89  int line;
90 };
91 
92 
93 class T_CORE_EXPORT ClientErrorException : public std::exception
94 {
95 public:
97  : std::exception(e), code(e.code) { }
98  ClientErrorException(int statusCode)
99  : code(statusCode) { }
100  virtual ~ClientErrorException() throw() { }
101  int statusCode() const { return code; }
102  virtual void raise() const { throw *this; }
103  virtual std::exception *clone() const { return new ClientErrorException(*this); }
104 
105 private:
106  int code;
107 };
108 
109 
110 class T_CORE_EXPORT StandardException : public std::exception
111 {
112 public:
114  : std::exception(e), msg(e.msg), file(e.file), line(e.line) { }
115  StandardException(const QString &message, const char *fileName = "", int lineNumber = 0)
116  : msg(message), file(fileName), line(lineNumber) { }
117  virtual ~StandardException() throw() { }
118  QString message() const { return msg; }
119  QString fileName() const { return file; }
120  int lineNumber() const { return line; }
121  virtual void raise() const { throw *this; }
122  virtual std::exception *clone() const { return new StandardException(*this); }
123 
124 private:
125  QString msg;
126  QString file;
127  int line;
128 };
129 
130 #endif // TFEXCEPTION_H
#define T_CORE_EXPORT
Definition: tglobal.h:81
QString fileName() const
Returns the file name.
Definition: tfexception.h:81
QString fileName() const
Returns the file name.
Definition: tfexception.h:119
ClientErrorException(const ClientErrorException &e)
Copy constructor.
Definition: tfexception.h:96
virtual ~StandardException()
Destructor.
Definition: tfexception.h:117
QString fileName() const
Returns the file name.
Definition: tfexception.h:60
The StandardException class represents an exception that can be thrown when standard error occurs in ...
Definition: tfexception.h:110
RuntimeException(const QString &message, const char *fileName="", int lineNumber=0)
Constructor.
Definition: tfexception.h:14
QString message() const
Returns the message.
Definition: tfexception.h:80
virtual ~SqlException()
Destructor.
Definition: tfexception.h:58
int lineNumber() const
Return the line number.
Definition: tfexception.h:82
QString message() const
Returns the message.
Definition: tfexception.h:118
SecurityException(const QString &message, const char *fileName="", int lineNumber=0)
Constructor.
Definition: tfexception.h:35
KvsException(const QString &message, const char *fileName="", int lineNumber=0)
Constructor.
Definition: tfexception.h:77
int lineNumber() const
Return the line number.
Definition: tfexception.h:19
virtual std::exception * clone() const
Creates and returns a deep copy of the current data.
Definition: tfexception.h:21
virtual std::exception * clone() const
Creates and returns a deep copy of the current data.
Definition: tfexception.h:42
KvsException(const KvsException &e)
Copy constructor.
Definition: tfexception.h:75
StandardException(const StandardException &e)
Copy constructor.
Definition: tfexception.h:113
The ClientErrorException class represents an exception that can be thrown when communication error wi...
Definition: tfexception.h:93
QString fileName() const
Returns the file name.
Definition: tfexception.h:39
ClientErrorException(int statusCode)
Constructor.
Definition: tfexception.h:98
int statusCode() const
Returns the status code.
Definition: tfexception.h:101
virtual std::exception * clone() const
Creates and returns a deep copy of the current data.
Definition: tfexception.h:122
virtual ~ClientErrorException()
Destructor.
Definition: tfexception.h:100
QString message() const
Returns the message.
Definition: tfexception.h:17
RuntimeException(const RuntimeException &e)
Copy constructor.
Definition: tfexception.h:12
StandardException(const QString &message, const char *fileName="", int lineNumber=0)
Constructor.
Definition: tfexception.h:115
The SecurityException class represents an exception that can be thrown when a security issue is detec...
Definition: tfexception.h:30
int lineNumber() const
Return the line number.
Definition: tfexception.h:61
QString fileName() const
Returns the file name.
Definition: tfexception.h:18
QString message() const
Returns the message.
Definition: tfexception.h:38
The SqlException class represents an exception that can be thrown when SQL database error occurs...
Definition: tfexception.h:51
virtual ~KvsException()
Destructor.
Definition: tfexception.h:79
virtual std::exception * clone() const
Creates and returns a deep copy of the current data.
Definition: tfexception.h:84
virtual std::exception * clone() const
Creates and returns a deep copy of the current data.
Definition: tfexception.h:63
int lineNumber() const
Return the line number.
Definition: tfexception.h:120
SecurityException(const SecurityException &e)
Copy constructor.
Definition: tfexception.h:33
The RuntimeException class represents an exception that can be thrown when runtime error occurs...
Definition: tfexception.h:9
QString message() const
Returns the message.
Definition: tfexception.h:59
int lineNumber() const
Return the line number.
Definition: tfexception.h:40
virtual ~RuntimeException()
Destructor.
Definition: tfexception.h:16
The KvsException class represents an exception that can be thrown when KVS database error occurs...
Definition: tfexception.h:72
virtual std::exception * clone() const
Creates and returns a deep copy of the current data.
Definition: tfexception.h:103
virtual ~SecurityException()
Destructor.
Definition: tfexception.h:37
SqlException(const SqlException &e)
Copy constructor.
Definition: tfexception.h:54
SqlException(const QString &message, const char *fileName="", int lineNumber=0)
Constructor.
Definition: tfexception.h:56