830911f6f9
git-svn-id: svn://localhost/ardour2/branches/3.0@6760 d708f5d6-7413-0410-9779-e7cbd77b26cf
41 lines
780 B
C++
41 lines
780 B
C++
#ifndef AUDIOGRAPHER_EXCEPTION_H
|
|
#define AUDIOGRAPHER_EXCEPTION_H
|
|
|
|
#include <exception>
|
|
#include <string>
|
|
|
|
#include <boost/format.hpp>
|
|
|
|
#include "audiographer/debug_utils.h"
|
|
|
|
namespace AudioGrapher
|
|
{
|
|
|
|
/** AudioGrapher Exception class.
|
|
* Automatically tells which class an exception was thrown from.
|
|
*/
|
|
class Exception : public std::exception
|
|
{
|
|
public:
|
|
template<typename T>
|
|
Exception (T const & thrower, std::string const & reason)
|
|
: reason (boost::str (boost::format
|
|
("Exception thrown by %1%: %2%")
|
|
% DebugUtils::demangled_name (thrower) % reason))
|
|
{}
|
|
|
|
virtual ~Exception () throw() { }
|
|
|
|
const char* what() const throw()
|
|
{
|
|
return reason.c_str();
|
|
}
|
|
|
|
private:
|
|
std::string const reason;
|
|
|
|
};
|
|
|
|
} // namespace AudioGrapher
|
|
|
|
#endif // AUDIOGRAPHER_EXCEPTION_H
|