]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/application.cpp
Report uncaught exceptions with a MessageBox on win32
[libs/core.git] / source / core / application.cpp
index bcb7e3de49e2cb0b3058844f2559f336cfdc5a50..cc9946cb32c7410a3f8e30fbd568728b55ee2c82 100644 (file)
@@ -62,6 +62,12 @@ int Application::run(int argc, char **argv, void *data)
        }
        catch(const exception &e)
        {
+               delete app_;
+
+#ifdef WIN32
+               string msg=Debug::demangle(typeid(e).name())+":\n"+e.what();
+               MessageBox(0, msg.c_str(), "Uncaught exception", MB_OK|MB_ICONERROR);
+#else
                cerr<<"An uncaught exception occurred.\n";
                cerr<<"  type:   "<<Debug::demangle(typeid(e).name())<<'\n';
                cerr<<"  what(): "<<e.what()<<'\n';
@@ -79,8 +85,8 @@ int Application::run(int argc, char **argv, void *data)
                                cerr<<" from "<<i->file<<'\n';
                        }
                }
+#endif
 
-               delete app_;
                return 124;
        }
 }