summaryrefslogtreecommitdiff
path: root/RealtimeSync/application.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:04:59 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:04:59 +0200
commitf570e2f2685aa43aa518c2f8578391c1847cddbe (patch)
treeb9376b3a7e807c5e0c4cf3d5615c14034d9675d6 /RealtimeSync/application.cpp
parent3.2 (diff)
downloadFreeFileSync-f570e2f2685aa43aa518c2f8578391c1847cddbe.tar.gz
FreeFileSync-f570e2f2685aa43aa518c2f8578391c1847cddbe.tar.bz2
FreeFileSync-f570e2f2685aa43aa518c2f8578391c1847cddbe.zip
3.3
Diffstat (limited to 'RealtimeSync/application.cpp')
-rw-r--r--RealtimeSync/application.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp
index b974fb89..68cebae0 100644
--- a/RealtimeSync/application.cpp
+++ b/RealtimeSync/application.cpp
@@ -13,6 +13,7 @@
#include "../shared/localization.h"
#include "xmlFreeFileSync.h"
#include "../shared/standardPaths.h"
+#include <wx/file.h>
#ifdef FFS_LINUX
#include <gtk/gtk.h>
@@ -80,3 +81,30 @@ void Application::OnStartApplication(wxIdleEvent& event)
frame->SetIcon(*GlobalResources::getInstance().programIcon); //set application icon
frame->Show();
}
+
+
+bool Application::OnExceptionInMainLoop()
+{
+ throw; //just re-throw exception and avoid display of additional exception messagebox: it will be caught in OnRun()
+}
+
+
+int Application::OnRun()
+{
+ try
+ {
+ wxApp::OnRun();
+ }
+ catch (const std::exception& e) //catch all STL exceptions
+ {
+ //unfortunately it's not always possible to display a message box in this erroneous situation, however (non-stream) file output always works!
+ wxFile safeOutput(FreeFileSync::getLastErrorTxtFile(), wxFile::write);
+ safeOutput.Write(wxString::FromAscii(e.what()));
+
+ wxMessageBox(wxString::FromAscii(e.what()), _("An exception occured!"), wxOK | wxICON_ERROR);
+ return -9;
+ }
+
+ return 0; //program's return value
+}
+
bgstack15