summaryrefslogtreecommitdiff
path: root/RealtimeSync/application.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:20:29 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:20:29 +0200
commitb8f13e45be884dc12884ebe8f3dcd9eecb23a106 (patch)
tree22a6d8b96815d626061ff3e2d432c13078fca5c4 /RealtimeSync/application.cpp
parent5.4 (diff)
downloadFreeFileSync-b8f13e45be884dc12884ebe8f3dcd9eecb23a106.tar.gz
FreeFileSync-b8f13e45be884dc12884ebe8f3dcd9eecb23a106.tar.bz2
FreeFileSync-b8f13e45be884dc12884ebe8f3dcd9eecb23a106.zip
5.5
Diffstat (limited to 'RealtimeSync/application.cpp')
-rw-r--r--RealtimeSync/application.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp
index e756675e..b136b720 100644
--- a/RealtimeSync/application.cpp
+++ b/RealtimeSync/application.cpp
@@ -7,15 +7,15 @@
#include "application.h"
#include "main_dlg.h"
#include <wx/event.h>
-#include "resources.h"
+#include <wx/log.h>
#include <wx/msgdlg.h>
-#include "../lib/localization.h"
-#include "xml_ffs.h"
-#include "../lib/ffs_paths.h"
-#include <wx/file.h>
+#include <wx+/serialize.h>
#include <wx+/string_conv.h>
-#include <wx/log.h>
#include <zen/file_handling.h>
+#include "resources.h"
+#include "xml_ffs.h"
+#include "../lib/localization.h"
+#include "../lib/ffs_paths.h"
#ifdef FFS_LINUX
#include <gtk/gtk.h>
@@ -97,27 +97,31 @@ bool Application::OnExceptionInMainLoop()
int Application::OnRun()
{
+
+ auto processException = [](const std::wstring& msg)
+ {
+ //it's not always possible to display a message box, e.g. corrupted stack, however low-level file output works!
+ try
+ {
+ saveBinStream(getConfigDir() + Zstr("LastError.txt"), utfCvrtTo<std::string>(msg)); //throw FileError
+ }
+ catch (const FileError&) {}
+
+ wxSafeShowMessage(_("An exception occurred!") + L" - FFS", msg);
+ };
+
try
{
wxApp::OnRun();
}
catch (const std::exception& e) //catch all STL exceptions
{
- //it's not always possible to display a message box, e.g. corrupted stack, however (non-stream) file output works!
- wxFile safeOutput(toWx(getConfigDir()) + L"LastError.txt", wxFile::write);
- safeOutput.Write(utfCvrtTo<wxString>(e.what()));
-
- wxSafeShowMessage(_("An exception occurred!") + L" - RTS", utfCvrtTo<wxString>(e.what()));
+ processException(utfCvrtTo<std::wstring>(e.what()));
return -9;
}
catch (...) //catch the rest
{
- const wxString& msg = L"Unknown error.";
-
- wxFile safeOutput(toWx(getConfigDir()) + L"LastError.txt", wxFile::write);
- safeOutput.Write(msg);
-
- wxSafeShowMessage(_("An exception occurred!"), msg);
+ processException(L"Unknown error.");
return -9;
}
bgstack15