]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/app/application.cpp
More specific error message for "unknown" exceptions.
[toast/confclerk.git] / src / app / application.cpp
index 353d8c7b56dbfaa171fee0c709fad01f807b2885..e8ad62bb44209875e5f78639c3b9ab67a252628c 100644 (file)
@@ -1,24 +1,31 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
+ * Copyright (C) 2011-2017 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
- * This file is part of fosdem-schedule.
+ * This file is part of ConfClerk.
  *
- * fosdem-schedule is free software: you can redistribute it and/or modify it
+ * ConfClerk is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
  * Software Foundation, either version 2 of the License, or (at your option)
  * any later version.
  *
- * fosdem-schedule is distributed in the hope that it will be useful, but
+ * ConfClerk is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  *
  * You should have received a copy of the GNU General Public License along with
- * fosdem-schedule.  If not, see <http://www.gnu.org/licenses/>.
+ * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
  */
+#if defined(__GNUC__) || defined(__llvm__) || defined(__clang__)
+#include <cxxabi.h>
+#endif
+#include <exception>
+
 #include "application.h"
+#include "errormessage.h"
 
-#include <ormrecord.h>
+#include "ormrecord.h"
 
 // if the application uses exceptions,
 // there is always a possibility that some will leak uncached from event handler
@@ -28,10 +35,19 @@ bool Application::notify(QObject* receiver, QEvent* event)
     try {
         return QApplication::notify(receiver, event);
     } catch (OrmException& e) {
-        qWarning() << "UNCAUGHT EXCEPTION: OrmException, text= " << e.text();
+        error_message("UNCAUGHT OrmException: " + e.text());
+        return false;
+    } catch (std::exception& e) {
+        error_message("UNCAUGHT exception: " + QString(e.what()));
         return false;
     } catch (...) {
-        qWarning() << "UNCAUGHT EXCEPTION: unknown";
+        error_message("UNCAUGHT exception: " +
+#if defined(__GNUC__) || defined(__llvm__) || defined(__clang__)
+                QString(__cxxabiv1::__cxa_current_exception_type()->name())
+#else
+                "unknown"
+#endif
+                );
         return false;
     }
 }