]> git.tdb.fi Git - libs/core.git/commitdiff
Trap and explain uncaught exceptions
authorMikko Rasa <tdb@tdb.fi>
Sat, 7 Jul 2007 17:51:16 +0000 (17:51 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sat, 7 Jul 2007 17:51:16 +0000 (17:51 +0000)
source/core/application.cpp

index 0e93a9c653064ec4aeccbd39d358a80e74fb7be9..0ef3443e8eac4fab7173b15df42c9cd1360b4e88 100644 (file)
@@ -48,9 +48,20 @@ int Application::run(int argc, char **argv)
                return 1;
        }
 
-       int result=app_->main();
-       delete app_;
-       return result;
+       try
+       {
+               int result=app_->main();
+               delete app_;
+               return result;
+       }
+       catch(const exception &e)
+       {
+               cerr<<"An uncaught exception occurred.\n";
+               cerr<<"  type:   "<<typeid(e).name()<<'\n';
+               cerr<<"  what(): "<<e.what()<<'\n';
+               delete app_;
+               throw;
+       }
 }
 
 /**