| 1 | /* |
| 2 | The software in this package is distributed under the GNU General |
| 3 | Public License version 2 (with a special exception described below). |
| 4 | |
| 5 | A copy of GNU General Public License (GPL) is included in this distribution, |
| 6 | in the file COPYING.GPL. |
| 7 | |
| 8 | As a special exception, if other files instantiate templates or use macros |
| 9 | or inline functions from this file, or you compile this file and link it |
| 10 | with other works to produce a work based on this file, this file |
| 11 | does not by itself cause the resulting work to be covered |
| 12 | by the GNU General Public License. |
| 13 | |
| 14 | However the source code for this file must still be made available |
| 15 | in accordance with section (3) of the GNU General Public License. |
| 16 | |
| 17 | This exception does not invalidate any other reasons why a work based |
| 18 | on this file might be covered by the GNU General Public License. |
| 19 | */ |
| 20 | /*************************************************************************** |
| 21 | exception.hxx - exception classes |
| 22 | ------------------- |
| 23 | copyright : (C) 2001 by Intra2net AG |
| 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 | |
| 35 | class 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 | |
| 47 | class 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 | |
| 54 | class 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 | |
| 61 | class 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 | |
| 68 | class CONNECTION_SOCKET; |
| 69 | |
| 70 | class 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 | |
| 79 | class 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 | |
| 86 | class 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 | |
| 93 | class 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 | |
| 100 | class 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 | |
| 107 | class 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 | |
| 114 | class 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 | |
| 121 | class 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 | |
| 128 | class 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 | |
| 135 | class 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 | |
| 142 | class 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 | |
| 149 | class 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 | |
| 156 | class 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 | |
| 163 | class 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 | |
| 170 | class 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 | |
| 177 | class 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 | |
| 184 | class 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 | |
| 191 | class 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 | |
| 198 | class 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 | |
| 205 | class 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 | |
| 212 | class 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 |