exceptions.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _OPENCOG_EXCEPTIONS_H
00027 #define _OPENCOG_EXCEPTIONS_H
00028
00029 #include <string>
00030
00031 #include <stdarg.h>
00032 #include <string.h>
00033
00034 #define STRINGIFY(x) #x
00035 #define TOSTRING(x) STRINGIFY(x)
00036 #define TRACE_INFO " ("__FILE__":"TOSTRING(__LINE__)")"
00037
00038 namespace opencog
00039 {
00040
00044 class StandardException
00045 {
00046
00047 private:
00051 char * message;
00052
00053 protected:
00054
00059 void parseErrorMessage(const char* fmt, va_list ap, bool logError=true);
00060 void parseErrorMessage(const char * trace, const char* fmt, va_list ap, bool logError=true);
00061
00062 public:
00063
00067 StandardException();
00068 ~StandardException();
00069
00075 const char* getMessage() const;
00076
00082 void setMessage(const char *);
00083
00084 };
00085
00090 class RuntimeException : public StandardException
00091 {
00092
00093 public:
00094
00101 RuntimeException(const char*, const char*, ...);
00102
00106 RuntimeException();
00107
00111 ~RuntimeException();
00112
00113 };
00114
00118 class XMLException : public RuntimeException
00119 {
00120
00121 public:
00122
00130 XMLException(const char*, const char*, ...);
00131
00132 };
00133
00137 class IOException : public RuntimeException
00138 {
00139
00140 public:
00141
00149 IOException(const char*, const char*, ...);
00150
00151 };
00152
00156 class ComboException : public RuntimeException
00157 {
00158
00159 public:
00160
00168 ComboException(const char*, const char*, ...);
00169
00170 };
00171
00175 class IndexErrorException : public RuntimeException
00176 {
00177
00178 public:
00179
00187 IndexErrorException(const char*, const char*, ...);
00188
00189 };
00190
00198 class InvalidParamException : public RuntimeException
00199 {
00200
00201 public:
00202
00210 InvalidParamException(const char*, const char*, ...);
00211
00212 };
00213
00218 class InconsistenceException : public RuntimeException
00219 {
00220
00221 public:
00222
00230 InconsistenceException(const char*, const char*, ...);
00231
00232 };
00233
00238 class FatalErrorException : public StandardException
00239 {
00240
00241 public:
00242
00250 FatalErrorException(const char*, const char*, ...);
00251
00252 };
00253
00260 class NotFoundException : public StandardException {
00261 public:
00262
00270 NotFoundException(const char*, const char*, ...);
00271
00272 };
00273
00278 class NetworkException : public StandardException
00279 {
00280
00281 public:
00282
00290 NetworkException(const char*, const char*, ...);
00291
00292 };
00293
00294
00298 class AssertionException
00299 {
00300
00301 public:
00302
00303 AssertionException(const char*, ...);
00304 AssertionException(const char* fmt, va_list ap);
00305 };
00306
00307 }
00308
00309 #endif // _OPENCOG_EXCEPTIONS_H