#ifndef __JTRIGGEREXCEPTION__ #define __JTRIGGEREXCEPTION__ #include #include #include namespace JTRIGGER { /** * General exception */ class JTriggerException : public std::exception { public: /** * Constructor. * * \param error error message */ JTriggerException(const std::string& error) : std::exception(), buffer(error) {} /** * Destructor. */ ~JTriggerException() throw() {} /** * Get error message. * * \return error message */ virtual const char* what() const throw() { return buffer.c_str(); } private: const std::string buffer; }; /** * Print error message of JTriggerException. * * \param out output stream * \param exception JTriggerException */ inline std::ostream& operator<<(std::ostream& out, const JTriggerException& exception) { return out << exception.what(); } } #endif