FIX: Flush log in generic_exception_handle
Change-Id: I07fd22ace35418f18694fec017a0a7633065ef10
This commit is contained in:
parent
6887626313
commit
2003bbd768
|
@ -951,23 +951,26 @@ static void generic_exception_handle()
|
||||||
} catch (const std::bad_alloc& ex) {
|
} catch (const std::bad_alloc& ex) {
|
||||||
// bad_alloc in main thread is most likely fatal. Report immediately to the user (wxLogError would be delayed)
|
// bad_alloc in main thread is most likely fatal. Report immediately to the user (wxLogError would be delayed)
|
||||||
// and terminate the app so it is at least certain to happen now.
|
// and terminate the app so it is at least certain to happen now.
|
||||||
|
BOOST_LOG_TRIVIAL(error) << boost::format("std::bad_alloc exception: %1%") % ex.what();
|
||||||
|
flush_logs();
|
||||||
wxString errmsg = wxString::Format(_L("BambuStudio will terminate because of running out of memory."
|
wxString errmsg = wxString::Format(_L("BambuStudio will terminate because of running out of memory."
|
||||||
"It may be a bug. It will be appreciated if you report the issue to our team."));
|
"It may be a bug. It will be appreciated if you report the issue to our team."));
|
||||||
wxMessageBox(errmsg + "\n\n" + wxString(ex.what()), _L("Fatal error"), wxOK | wxICON_ERROR);
|
wxMessageBox(errmsg + "\n\n" + wxString(ex.what()), _L("Fatal error"), wxOK | wxICON_ERROR);
|
||||||
BOOST_LOG_TRIVIAL(error) << boost::format("std::bad_alloc exception: %1%") % ex.what();
|
|
||||||
|
|
||||||
std::terminate();
|
std::terminate();
|
||||||
//throw;
|
//throw;
|
||||||
} catch (const boost::io::bad_format_string& ex) {
|
} catch (const boost::io::bad_format_string& ex) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what();
|
||||||
|
flush_logs();
|
||||||
wxString errmsg = _L("BambuStudio will terminate because of a localization error. "
|
wxString errmsg = _L("BambuStudio will terminate because of a localization error. "
|
||||||
"It will be appreciated if you report the specific scenario this issue happened.");
|
"It will be appreciated if you report the specific scenario this issue happened.");
|
||||||
wxMessageBox(errmsg + "\n\n" + wxString(ex.what()), _L("Critical error"), wxOK | wxICON_ERROR);
|
wxMessageBox(errmsg + "\n\n" + wxString(ex.what()), _L("Critical error"), wxOK | wxICON_ERROR);
|
||||||
BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what();
|
|
||||||
std::terminate();
|
std::terminate();
|
||||||
//throw;
|
//throw;
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
wxLogError(format_wxstr(_L("BambuStudio got an unhandled exception: %1%"), ex.what()));
|
wxLogError(format_wxstr(_L("BambuStudio got an unhandled exception: %1%"), ex.what()));
|
||||||
BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what();
|
BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what();
|
||||||
|
flush_logs();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
|
|
Loading…
Reference in New Issue