Merge branch 'daemon-ext'
[libi2ncommon] / src / exception.hxx
CommitLineData
0e23f538
TJ
1/*
2The software in this package is distributed under the GNU General
3Public License version 2 (with a special exception described below).
4
5A copy of GNU General Public License (GPL) is included in this distribution,
6in the file COPYING.GPL.
7
8As a special exception, if other files instantiate templates or use macros
9or inline functions from this file, or you compile this file and link it
10with other works to produce a work based on this file, this file
11does not by itself cause the resulting work to be covered
12by the GNU General Public License.
13
14However the source code for this file must still be made available
15in accordance with section (3) of the GNU General Public License.
16
17This exception does not invalidate any other reasons why a work based
18on this file might be covered by the GNU General Public License.
19*/
9e16d607
GE
20/***************************************************************************
21 exception.hxx - exception classes
22 -------------------
0e23f538 23 copyright : (C) 2001 by Intra2net AG
9e16d607
GE
24 ***************************************************************************/
25
26#ifndef __EXCEPTION
27#define __EXCEPTION
28
29#include <stdexcept>
30#include <string>
31
32#define EXCEPTION(xname,xarg) xname(xarg,__LINE__,__FILE__,__DATE__ " " __TIME__)
33#define EXCEPTION2(xname,xarg,xarg2) xname(xarg,xarg2,__LINE__,__FILE__,__DATE__ " " __TIME__)
34
35class source_info_exception
36{
37 public:
38 const int line;
39 const char* const file;
40 const char* const timestamp;
41
42 source_info_exception(const int l, const char* f, const char* t)
43 : line(l), file(f), timestamp(t)
44 {}
45};
46
47class runtime_error_src : public std::runtime_error, public source_info_exception
48{
49 public:
50 runtime_error_src(const std::string& __arg,const int l, const char* f, const char* t)
51 : runtime_error(__arg), source_info_exception(l,f,t) {}
52};
53
54class network_error : public runtime_error_src
55{
56 public:
57 network_error(const std::string& __arg,const int l, const char* f, const char* t)
58 : runtime_error_src(__arg,l,f,t) {}
59};
60
61class network_server_error : public network_error
62{
63 public:
64 network_server_error(const std::string& __arg,const int l, const char* f, const char* t)
65 : network_error(__arg,l,f,t) {}
66};
67
68class CONNECTION_SOCKET;
69
70class network_client_error : public network_error
71{
72 public:
73 CONNECTION_SOCKET *con;
74
75 network_client_error(const std::string& __arg,CONNECTION_SOCKET *c, const int l, const char* f, const char* t)
76 : network_error(__arg,l,f,t), con(c) {}
77};
78
79class database_error : public runtime_error_src
80{
81 public:
82 database_error(const std::string& __arg,const int l, const char* f, const char* t)
83 : runtime_error_src(__arg,l,f,t) {}
84};
85
86class database_query_error : public database_error
87{
88 public:
89 database_query_error(const std::string& __arg,const int l, const char* f, const char* t)
90 : database_error(__arg,l,f,t) {}
91};
92
93class signal_error : public runtime_error_src
94{
95 public:
96 signal_error(const std::string& __arg,const int l, const char* f, const char* t)
97 : runtime_error_src(__arg,l,f,t) {}
98};
99
100class pipestream_error : public runtime_error_src
101{
102 public:
103 pipestream_error(const std::string& __arg,const int l, const char* f, const char* t)
104 : runtime_error_src(__arg,l,f,t) {}
105};
106
107class insocketstream_error : public runtime_error_src
108{
109 public:
110 insocketstream_error(const std::string& __arg,const int l, const char* f, const char* t)
111 : runtime_error_src(__arg,l,f,t) {}
112};
113
114class variable_data_error : public runtime_error_src
115{
116 public:
117 variable_data_error(const std::string& __arg,const int l, const char* f, const char* t)
118 : runtime_error_src(__arg,l,f,t) {}
119};
120
121class variable_range_error : public variable_data_error
122{
123 public:
124 variable_range_error(const std::string& __arg,const int l, const char* f, const char* t)
125 : variable_data_error(__arg,l,f,t) {}
126};
127
128class variable_double_error : public variable_data_error
129{
130 public:
131 variable_double_error(const std::string& __arg,const int l, const char* f, const char* t)
132 : variable_data_error(__arg,l,f,t) {}
133};
134
135class variable_ip_error : public variable_data_error
136{
137 public:
138 variable_ip_error(const std::string& __arg,const int l, const char* f, const char* t)
139 : variable_data_error(__arg,l,f,t) {}
140};
141
142class variable_integrity_error : public variable_data_error
143{
144 public:
145 variable_integrity_error(const std::string& __arg,const int l, const char* f, const char* t)
146 : variable_data_error(__arg,l,f,t) {}
147};
148
149class variable_instance_error : public variable_data_error
150{
151 public:
152 variable_instance_error(const std::string& __arg,const int l, const char* f, const char* t)
153 : variable_data_error(__arg,l,f,t) {}
154};
155
156class variable_child_error : public variable_data_error
157{
158 public:
159 variable_child_error(const std::string& __arg,const int l, const char* f, const char* t)
160 : variable_data_error(__arg,l,f,t) {}
161};
162
163class variable_notfound_error : public variable_data_error
164{
165 public:
166 variable_notfound_error(const std::string& __arg,const int l, const char* f, const char* t)
167 : variable_data_error(__arg,l,f,t) {}
168};
169
170class autoupdate_error : public runtime_error_src
171{
172 public:
173 autoupdate_error(const std::string& __arg,const int l, const char* f, const char* t)
174 : runtime_error_src(__arg,l,f,t) {}
175};
176
177class scheduler_dir_error : public runtime_error_src
178{
179 public:
180 scheduler_dir_error(const std::string& __arg,const int l, const char* f, const char* t)
181 : runtime_error_src(__arg,l,f,t) {}
182};
183
184class scheduler_prog_error : public runtime_error_src
185{
186 public:
187 scheduler_prog_error(const std::string& __arg,const int l, const char* f, const char* t)
188 : runtime_error_src(__arg,l,f,t) {}
189};
190
191class logic_error_src : public std::logic_error, public source_info_exception
192{
193 public:
194 logic_error_src(const std::string& __arg,const int l, const char* f, const char* t)
195 : logic_error(__arg), source_info_exception(l,f,t) {}
196};
197
198class argument_error : public logic_error_src
199{
200 public:
201 argument_error(const std::string& __arg,const int l, const char* f, const char* t)
202 : logic_error_src(__arg,l,f,t) {}
203};
204
205class message_error : public logic_error_src
206{
207 public:
208 message_error(const std::string& __arg,const int l, const char* f, const char* t)
209 : logic_error_src(__arg,l,f,t) {}
210};
211
212class variable_error : public logic_error_src
213{
214 public:
215 variable_error(const std::string& __arg,const int l, const char* f, const char* t)
216 : logic_error_src(__arg,l,f,t) {}
217};
218
219#endif