]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/except.h
Add new exception classes for some common errors
[libs/core.git] / source / core / except.h
diff --git a/source/core/except.h b/source/core/except.h
new file mode 100644 (file)
index 0000000..65d9ef9
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef MSP_CORE_EXCEPT_H_
+#define MSP_CORE_EXCEPT_H_
+
+#include <stdexcept>
+
+namespace Msp {
+
+class invalid_state: public std::logic_error
+{
+public:
+       invalid_state(const std::string &w): logic_error(w) { }
+};
+
+
+class already_called: public invalid_state
+{
+public:
+       already_called(const std::string &w): invalid_state(w) { }
+};
+
+
+class unsupported: public std::logic_error
+{
+public:
+       unsupported(const std::string &w): logic_error(w) { }
+};
+
+
+class internal_error: public std::logic_error
+{
+public:
+       internal_error(const std::string &w): logic_error(w) { }
+};
+
+} // namespace Msp;
+
+#endif