00001 // $Header: /bes/bes/BossCvs/Calibration/rdbModel/rdbModel/RdbException.h,v 1.1.1.1 2005/10/17 06:10:53 maqm Exp $ 00002 #ifndef RDBMODEL_RDBEXCEPTION_H 00003 #define RDBMODEL_RDBEXCEPTION_H 00004 #include <exception> 00005 00006 namespace rdbModel { 00007 00008 class RdbException : std::exception { 00009 public: 00010 RdbException(const std::string& extraInfo = "", int code=0) : 00011 std::exception(), 00012 m_name("RdbException"), m_extra(extraInfo), m_code(code) {} 00013 virtual ~RdbException() throw() {} 00014 virtual std::string getMsg() { 00015 std::string msg = m_name + ": " + m_extra; 00016 return msg;} 00017 virtual int getCode() const { return m_code;} 00018 virtual const char* what() { 00019 return m_extra.c_str(); 00020 } 00021 protected: 00022 std::string m_name; 00023 private: 00024 std::string m_extra; 00025 int m_code; 00026 }; 00027 00028 } 00029 #endif