PresetUpdater: Don't fail as hard if version not found in index #1821

GUI_App: Add OnExceptionInMainLoop handler
This commit is contained in:
Vojtech Kral 2019-02-14 15:28:18 +01:00
parent eb643a1f52
commit d8c7966bec
3 changed files with 51 additions and 15 deletions

View file

@ -3,8 +3,10 @@
#include "GUI_ObjectManipulation.hpp"
#include "I18N.hpp"
#include <exception>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/log/trivial.hpp>
#include <wx/stdpaths.h>
#include <wx/imagpng.h>
@ -181,7 +183,6 @@ bool GUI_App::OnInit()
mainframe->Close();
} catch (const std::exception &ex) {
show_error(nullptr, ex.what());
mainframe->Close();
}
});
@ -681,6 +682,23 @@ void GUI_App::load_current_presets()
}
}
bool GUI_App::OnExceptionInMainLoop()
{
try {
throw;
} catch (const std::exception &ex) {
const std::string error = (boost::format("Uncaught exception: %1%") % ex.what()).str();
BOOST_LOG_TRIVIAL(error) << error;
show_error(nullptr, from_u8(error));
} catch (...) {
const char *error = "Uncaught exception: Unknown error";
BOOST_LOG_TRIVIAL(error) << error;
show_error(nullptr, from_u8(error));
}
return false;
}
#ifdef __APPLE__
// wxWidgets override to get an event on open files.
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)