diff --git a/src/app/console.cpp b/src/app/console.cpp index 891c85493..2f79142cd 100644 --- a/src/app/console.cpp +++ b/src/app/console.cpp @@ -155,7 +155,7 @@ void Console::printf(const char* format, ...) void Console::showException(const std::exception& e) { Console console; - console.printf("A problem has occurred.\n\nDetails:\n%s", e.what()); + console.printf("A problem has occurred.\n\nDetails:\n%s\n", e.what()); } } // namespace app diff --git a/src/app/ui/document_view.cpp b/src/app/ui/document_view.cpp index d2302d535..012d3fcb1 100644 --- a/src/app/ui/document_view.cpp +++ b/src/app/ui/document_view.cpp @@ -14,6 +14,7 @@ #include "app/app.h" #include "app/app_menus.h" #include "app/commands/commands.h" +#include "app/console.h" #include "app/document_access.h" #include "app/modules/editors.h" #include "app/modules/palettes.h" @@ -37,6 +38,8 @@ #include "ui/system.h" #include "ui/view.h" +#include + namespace app { using namespace ui; @@ -132,7 +135,20 @@ protected: } break; } - return Editor::onProcessMessage(msg); + + try { + return Editor::onProcessMessage(msg); + } + catch (const LockedDocumentException& ex) { + Console console; + Console::showException(ex); + console.printf("\nInternal details:\n" + "- Message type: %d\n" + "- Editor state: %s\n", + msg->type(), + getState() ? typeid(*getState().get()).name(): "None"); + return false; + } } private: