00001
00002
00003
00004 #ifndef DMLITE_CPP_EXCEPTIONS_H
00005 #define DMLITE_CPP_EXCEPTIONS_H
00006
00007 #include "../common/config.h"
00008 #include "../common/errno.h"
00009
00010 #include <cstdarg>
00011 #include <exception>
00012 #include <string>
00013
00014 namespace dmlite {
00015
00016
00017 class DmException: public std::exception {
00018 public:
00019 DmException();
00020 DmException(int code);
00021 DmException(int code, const std::string &string);
00022 DmException(int code, const char* fmt, va_list args);
00023 DmException(int code, const char* fmt, ...);
00024
00025 DmException(const DmException &de);
00026
00027 virtual ~DmException() throw();
00028
00029 int code() const throw();
00030 const char* what() const throw();
00031
00032 protected:
00033 int errorCode_;
00034 std::string errorMsg_;
00035
00036 void setMessage(const char* fmt, va_list args);
00037 };
00038
00039 };
00040
00041 #endif // DMLITE_CPP_EXCEPTIONS_H