// // File : Exception.hh // // Purpose: General exception class // // $Id: Exception.hh 8758 2010-09-27 12:16:24Z mathes $ // /** @file Exception.hh * Declaration of class Exception * @author H.-J. Mathes, FzK */ #ifndef _FdUtil_Exception_hh_ #define _FdUtil_Exception_hh_ #ifndef NO_VERSION # include #endif // NO_VERSION #include #include namespace FdUtil { /** The (our) general base class for all types of exceptions. * * Note: In principle this class is not really necessary if we inherit * all our exception classes from std::logic_error and construct * thsi base class properly (using the string argument). */ class Exception : public std::exception { public: /** Constructor for the class Exception. * * The object is initialised with the passed string argument. */ Exception(const std::string& what="Exception") throw() : fWhat(what) {} /** Destructor of the class Exception. */ ~Exception() throw() {} /** Return the string contents of the Exception object. */ //virtual const char* What() const { return fWhat.c_str(); } /** Return the string contents of the Exception object. */ const char* what() const throw() { return fWhat.c_str(); } private: std::string fWhat; }; } // namespace FdUtil #endif // _FdUtil_Exception_hh_