+/**
+Base class for all Msp exceptions.
+*/
+class Exception: public std::exception
+{
+public:
+ Exception(const std::string &);
+ ~Exception() throw() { }
+
+ const char *what() const throw() { return w.c_str(); }
+ const Debug::Backtrace &get_backtrace() const throw() { return bt; }
+private:
+ std::string w;
+ Debug::Backtrace bt;
+
+};
+
+/**
+Thrown when a function parameter has an invalid value.
+*/
+class InvalidParameterValue: public Exception
+{
+public:
+ InvalidParameterValue(const std::string &w_): Exception(w_) { }
+};
+
+/**
+Thrown when a lookup from a map fails.
+*/
+class KeyError: public Exception
+{
+public:
+ KeyError(const std::string &w_): Exception(w_) { }
+};
+
+/**
+Thrown when the current object state doesn't allow the requested action.
+*/
+class InvalidState: public Exception
+{
+public:
+ InvalidState(const std::string &w_): Exception(w_) { }
+};
+
+/**
+Thrown when the application is invoked with wrong parameters.
+*/
+class UsageError: public Exception