00001 #ifndef Mag_MagExceptions_H 00002 #define Mag_MagExceptions_H 00003 00004 #include <exception> 00005 00006 class MagException : public std::exception { 00007 public: 00008 MagException() throw() {} 00009 MagException( const std::string& message) : theMessage(message) {} 00010 virtual ~MagException() throw() {} 00011 virtual const char* what() const throw() { return theMessage.c_str();} 00012 private: 00013 std::string theMessage; 00014 }; 00015 00016 class MagGeometryError : public MagException { 00017 public: 00018 MagGeometryError() throw() {} 00019 MagGeometryError( const std::string& message) : MagException(message) {} 00020 virtual ~MagGeometryError() throw() {} 00021 }; 00022 00023 class MagLogicError : public MagException { 00024 public: 00025 MagLogicError() throw() {} 00026 MagLogicError( const std::string& message) : MagException(message) {} 00027 virtual ~MagLogicError() throw() {} 00028 }; 00029 00030 class GridInterpolator3DException : public std::exception { 00031 public: 00032 00033 GridInterpolator3DException( double a1, double b1, double c1, 00034 double a2, double b2, double c2) throw() : 00035 a1_(a1), b1_(b1), c1_(c1), a2_(a2), b2_(b2), c2_(c2) {} 00036 00037 virtual ~GridInterpolator3DException() throw() {} 00038 00039 virtual const char* what() const throw() { return "LinearGridInterpolator3D: field requested outside of grid validity";} 00040 00041 double a1_, b1_, c1_, a2_, b2_, c2_; 00042 }; 00043 00044 00045 00046 #endif