cd4f441501e8b607766532a650efd516f72a8e94
[libi2ncommon] / src / exception.hxx
1 /***************************************************************************
2                           exception.hxx  -  exception classes
3                              -------------------
4     begin                : Sat Oct 30 1999
5     copyright            : (C) 1999 by STYLETEC
6     email                : service@styletec.de
7  ***************************************************************************/
8
9 #ifndef __EXCEPTION
10 #define __EXCEPTION
11
12 #include <stdexcept>
13 #include <string>
14
15 #define EXCEPTION(xname,xarg) xname(xarg,__LINE__,__FILE__,__DATE__ " " __TIME__)
16 #define EXCEPTION2(xname,xarg,xarg2) xname(xarg,xarg2,__LINE__,__FILE__,__DATE__ " " __TIME__)
17
18 class source_info_exception
19 {
20    public:
21       const int line;
22       const char* const file;
23       const char* const timestamp;
24
25       source_info_exception(const int l, const char* f, const char* t)
26          : line(l), file(f), timestamp(t)
27          {}
28 };
29
30 class runtime_error_src : public std::runtime_error, public source_info_exception
31 {
32    public:
33       runtime_error_src(const std::string& __arg,const int l, const char* f, const char* t)
34          : runtime_error(__arg), source_info_exception(l,f,t) {}
35 };
36
37 class network_error : public runtime_error_src
38 {
39    public:
40       network_error(const std::string& __arg,const int l, const char* f, const char* t)
41          : runtime_error_src(__arg,l,f,t) {}
42 };
43
44 class network_server_error : public network_error
45 {
46    public:
47       network_server_error(const std::string& __arg,const int l, const char* f, const char* t)
48          : network_error(__arg,l,f,t) {}
49 };
50
51 class CONNECTION_SOCKET;
52
53 class network_client_error : public network_error
54 {
55    public:
56       CONNECTION_SOCKET *con;
57
58       network_client_error(const std::string& __arg,CONNECTION_SOCKET *c, const int l, const char* f, const char* t)
59          : network_error(__arg,l,f,t), con(c) {}
60 };
61
62 class database_error : public runtime_error_src
63 {
64    public:
65       database_error(const std::string& __arg,const int l, const char* f, const char* t)
66          : runtime_error_src(__arg,l,f,t) {}
67 };
68
69 class database_query_error : public database_error
70 {
71    public:
72       database_query_error(const std::string& __arg,const int l, const char* f, const char* t)
73          : database_error(__arg,l,f,t) {}
74 };
75
76 class signal_error : public runtime_error_src
77 {
78    public:
79       signal_error(const std::string& __arg,const int l, const char* f, const char* t)
80          : runtime_error_src(__arg,l,f,t) {}
81 };
82
83 class pipestream_error : public runtime_error_src
84 {
85    public:
86       pipestream_error(const std::string& __arg,const int l, const char* f, const char* t)
87          : runtime_error_src(__arg,l,f,t) {}
88 };
89
90 class insocketstream_error : public runtime_error_src
91 {
92    public:
93       insocketstream_error(const std::string& __arg,const int l, const char* f, const char* t)
94          : runtime_error_src(__arg,l,f,t) {}
95 };
96
97 class variable_data_error : public runtime_error_src
98 {
99    public:
100       variable_data_error(const std::string& __arg,const int l, const char* f, const char* t)
101          : runtime_error_src(__arg,l,f,t) {}
102 };
103
104 class variable_range_error : public variable_data_error
105 {
106    public:
107       variable_range_error(const std::string& __arg,const int l, const char* f, const char* t)
108          : variable_data_error(__arg,l,f,t) {}
109 };
110
111 class variable_double_error : public variable_data_error
112 {
113    public:
114       variable_double_error(const std::string& __arg,const int l, const char* f, const char* t)
115          : variable_data_error(__arg,l,f,t) {}
116 };
117
118 class variable_ip_error : public variable_data_error
119 {
120    public:
121       variable_ip_error(const std::string& __arg,const int l, const char* f, const char* t)
122          : variable_data_error(__arg,l,f,t) {}
123 };
124
125 class variable_integrity_error : public variable_data_error
126 {
127    public:
128       variable_integrity_error(const std::string& __arg,const int l, const char* f, const char* t)
129          : variable_data_error(__arg,l,f,t) {}
130 };
131
132 class variable_instance_error : public variable_data_error
133 {
134    public:
135       variable_instance_error(const std::string& __arg,const int l, const char* f, const char* t)
136          : variable_data_error(__arg,l,f,t) {}
137 };
138
139 class variable_child_error : public variable_data_error
140 {
141    public:
142       variable_child_error(const std::string& __arg,const int l, const char* f, const char* t)
143          : variable_data_error(__arg,l,f,t) {}
144 };
145
146 class variable_notfound_error : public variable_data_error
147 {
148    public:
149       variable_notfound_error(const std::string& __arg,const int l, const char* f, const char* t)
150          : variable_data_error(__arg,l,f,t) {}
151 };
152
153 class autoupdate_error : public runtime_error_src
154 {
155    public:
156       autoupdate_error(const std::string& __arg,const int l, const char* f, const char* t)
157          : runtime_error_src(__arg,l,f,t) {}
158 };
159
160 class scheduler_dir_error : public runtime_error_src
161 {
162    public:
163       scheduler_dir_error(const std::string& __arg,const int l, const char* f, const char* t)
164          : runtime_error_src(__arg,l,f,t) {}
165 };
166
167 class scheduler_prog_error : public runtime_error_src
168 {
169    public:
170       scheduler_prog_error(const std::string& __arg,const int l, const char* f, const char* t)
171          : runtime_error_src(__arg,l,f,t) {}
172 };
173
174 class logic_error_src : public std::logic_error, public source_info_exception
175 {
176    public:
177       logic_error_src(const std::string& __arg,const int l, const char* f, const char* t)
178          : logic_error(__arg), source_info_exception(l,f,t) {}
179 };
180
181 class argument_error : public logic_error_src
182 {
183    public:
184       argument_error(const std::string& __arg,const int l, const char* f, const char* t)
185          : logic_error_src(__arg,l,f,t) {}
186 };
187
188 class message_error : public logic_error_src
189 {
190    public:
191       message_error(const std::string& __arg,const int l, const char* f, const char* t)
192          : logic_error_src(__arg,l,f,t) {}
193 };
194
195 class variable_error : public logic_error_src
196 {
197    public:
198       variable_error(const std::string& __arg,const int l, const char* f, const char* t)
199          : logic_error_src(__arg,l,f,t) {}
200 };
201
202 #endif