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