diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index b72e7b84a..d31344810 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -209,4 +209,11 @@ void App::CallAfter(std::function cb_function) { this->callback_register.unlock(); } +void App::OnUnhandledException() { + try { throw; } + catch (std::exception &e) { + Slic3r::Log::fatal_error(LogChannel, LOG_WSTRING("Exception Caught: " << e.what())); + } +} + }} // namespace Slic3r::GUI diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index 83389bbf2..054acd001 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -36,6 +36,7 @@ public: void CallAfter(std::function cb_function); + void OnUnhandledException() override; private: std::shared_ptr gui_config; // GUI-specific configuration options