1 #ifndef AUDIOGRAPHER_EXCEPTION_H
2 #define AUDIOGRAPHER_EXCEPTION_H
7 #include <boost/format.hpp>
9 #include "audiographer/visibility.h"
10 #include "audiographer/debug_utils.h"
12 namespace AudioGrapher
15 /** AudioGrapher Exception class.
16 * Automatically tells which class an exception was thrown from.
18 class LIBAUDIOGRAPHER_API Exception : public std::exception
22 Exception (T const & thrower, std::string const & reason)
23 : reason (boost::str (boost::format
24 ("Exception thrown by %1%: %2%")
25 % DebugUtils::demangled_name (thrower) % reason))
28 virtual ~Exception () throw() { }
30 const char* what() const throw()
32 return reason.c_str();
36 std::string const reason;
40 } // namespace AudioGrapher
42 #endif // AUDIOGRAPHER_EXCEPTION_H