]> git.tdb.fi Git - libs/core.git/blobdiff - source/debug/errorreporter.h
Redesign uncaught exception handling to allow external reporters
[libs/core.git] / source / debug / errorreporter.h
diff --git a/source/debug/errorreporter.h b/source/debug/errorreporter.h
new file mode 100644 (file)
index 0000000..b0385ff
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef MSP_DEBUG_ERRORREPORTER_H_
+#define MSP_DEBUG_ERRORREPORTER_H_
+
+#include <stdexcept>
+
+namespace Msp {
+namespace Debug {
+
+class ErrorReporter
+{
+private:
+       ErrorReporter *prev;
+
+       static ErrorReporter *current;
+
+protected:
+       ErrorReporter();
+public:
+       virtual ~ErrorReporter();
+
+       static const ErrorReporter *get_current() { return current; }
+
+       virtual bool report_uncaught_exception(const std::exception &) const = 0;
+};
+
+} // namespace Debug
+} // namespace Msp
+
+#endif