00001 00002 #ifndef VARIANT_NUMBER_EXCEPTIONS_H 00003 #define VARIANT_NUMBER_EXCEPTIONS_H 00004 00005 #include <exception> 00006 #include <string> 00007 00008 namespace RosIntrospection 00009 { 00010 00011 class RangeException: public std::exception 00012 { 00013 public: 00014 00015 explicit RangeException(const char* message): msg_(message) {} 00016 explicit RangeException(const std::string& message): msg_(message) {} 00017 ~RangeException() throw () {} 00018 const char* what() const throw () 00019 { 00020 return msg_.c_str(); 00021 } 00022 00023 protected: 00024 std::string msg_; 00025 }; 00026 00027 class TypeException: public std::exception 00028 { 00029 public: 00030 00031 explicit TypeException(const char* message): msg_(message) {} 00032 explicit TypeException(const std::string& message): msg_(message) {} 00033 ~TypeException() throw () {} 00034 const char* what() const throw () 00035 { 00036 return msg_.c_str(); 00037 } 00038 00039 protected: 00040 std::string msg_; 00041 }; 00042 00043 } //end namespace 00044 00045 #endif