]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/application.cpp
Remove the custom demangle function and use GCC's abi::__cxa_demangle instead
[libs/core.git] / source / core / application.cpp
index 1012ea20f8b3ae400ead7b23fec92af737e8c2c2..a49802350f2f7d655125d8ab0480d9e41370c72a 100644 (file)
@@ -1,10 +1,12 @@
-/*
+/* $Id$
+
 This file is part of libmspcore
 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 #include <signal.h>
 #include <iostream>
+#include "../debug/demangle.h"
 #include "../time/units.h"
 #include "../time/utils.h"
 #include "application.h"
@@ -39,17 +41,28 @@ int Application::run(int argc, char **argv)
 
        try
        {
-               app_=reg_app_->create_app(argc, argv);
+               try
+               {
+                       app_=reg_app_->create_app(argc, argv);
+               }
+               catch(const UsageError &e)
+               {
+                       reg_app_->usage(e.what(), argv[0], e.get_brief());
+                       return 1;
+               }
+
+               int result=app_->main();
+               delete app_;
+               return result;
        }
-       catch(const UsageError &e)
+       catch(const exception &e)
        {
-               reg_app_->usage(e.what(), argv[0], e.get_brief());
-               return 1;
+               cerr<<"An uncaught exception occurred.\n";
+               cerr<<"  type:   "<<Debug::demangle(typeid(e).name())<<'\n';
+               cerr<<"  what(): "<<e.what()<<'\n';
+               delete app_;
+               return 124;
        }
-
-       int result=app_->main();
-       delete app_;
-       return result;
 }
 
 /**