typo fix
[pykit.git] / main.cc
diff --git a/main.cc b/main.cc
index c4d4910..cbf1f65 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -19,6 +19,7 @@
 #include <QFileInfo>
 #include <QFontDatabase>
 #include <QWebSettings>
+#include <QMessageBox>
 #include <boost/scoped_ptr.hpp>
 #include "MainWindow.hh"
 #include "PythonPublisher.hh"
@@ -37,13 +38,25 @@ namespace {
             return QSize();
         return QSize(coords[0].toInt(), coords[1].toInt());
     }
+
+    void showPlatformError(char const * reason)
+    {
+        QMessageBox msgBox;
+        msgBox.setText("Es ist ein interner Fehler bei der Initialisierung"
+                       " aufgetreten. Bitte notieren sie die folgende"
+                       " Fehlermeldung und wenden sie sich an den technischen"
+                       " Support.");
+        msgBox.setDetailedText(reason);
+        msgBox.setInformativeText(QString("%1 wird beendet.").arg(QApplication::applicationName()));
+        msgBox.setWindowTitle(QApplication::applicationName());
+        msgBox.exec();
+    }
 }
 
 int main(int argc, char *argv[])
 {
+    QApplication app (argc, argv);
     try {
-        QApplication app (argc, argv);
-
         QSettings settings ("pykit.ini", QSettings::IniFormat);
         QStringList arguments (app.arguments());
         settings.beginGroup("AppData");
@@ -110,9 +123,15 @@ int main(int argc, char *argv[])
 
         return app.exec();
     }
-    catch (std::exception & ex) {
+    catch (std::exception const & ex) {
         std::cerr << "Exception:\n" << ex.what() << "\n";
-        throw;
+        showPlatformError(ex.what());
+        return 1;
+    }
+    catch (...) {
+        std::cerr << "Exception: <undefined>\n";
+        showPlatformError("undefined error condition");
+        return 1;
     }
 }