]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/windows/errordialog.cpp
Implement graphical reporting for uncaught exceptions
[libs/gui.git] / source / graphics / windows / errordialog.cpp
diff --git a/source/graphics/windows/errordialog.cpp b/source/graphics/windows/errordialog.cpp
new file mode 100644 (file)
index 0000000..5215039
--- /dev/null
@@ -0,0 +1,19 @@
+#include <windows.h>
+#include <typeinfo>
+#include <msp/debug/demangle.h>
+#include "errordialog.h"
+
+using namespace std;
+
+namespace Msp {
+namespace Graphics {
+
+bool ErrorDialog::report_uncaught_exception(const exception &e) const
+{
+       string msg = Debug::demangle(typeid(e).name())+":\n"+e.what();
+       MessageBoxA(0, msg.c_str(), "Uncaught exception", MB_OK|MB_ICONERROR);
+       return false;
+}
+
+} // namespace Graphics
+} // namespace Msp