1 #ifndef AUDIOGRAPHER_EXCEPTION_H
2 #define AUDIOGRAPHER_EXCEPTION_H
7 #include <boost/format.hpp>
9 #include "audiographer/debug_utils.h"
11 namespace AudioGrapher
14 /** AudioGrapher Exception class.
15 * Automatically tells which class an exception was thrown from.
17 class Exception : public std::exception
21 Exception (T const & thrower, std::string const & reason)
22 : reason (boost::str (boost::format
23 ("Exception thrown by %1%: %2%")
24 % DebugUtils::demangled_name (thrower) % reason))
27 virtual ~Exception () throw() { }
29 const char* what() const throw()
31 return reason.c_str();
35 std::string const reason;
39 } // namespace AudioGrapher
41 #endif // AUDIOGRAPHER_EXCEPTION_H