From 2d929412210765aa81ab417ecbf09703ffccc0e8 Mon Sep 17 00:00:00 2001 From: Vankata453 <78196474+Vankata453@users.noreply.github.com> Date: Thu, 15 Aug 2024 12:55:24 +0300 Subject: [PATCH] Error handler: Print fatal exceptions to command line --- src/supertux/error_handler.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/supertux/error_handler.cpp b/src/supertux/error_handler.cpp index 9cc7d041292..5530c6ef4f5 100644 --- a/src/supertux/error_handler.cpp +++ b/src/supertux/error_handler.cpp @@ -290,16 +290,9 @@ ErrorHandler::error_dialog_crash(const std::string& stacktrace) void ErrorHandler::error_dialog_exception(const std::string& exception) { - std::stringstream stream; + char msg[] = "SuperTux has encountered a fatal exception!"; - stream << "SuperTux has encountered a fatal exception!"; - - if (!exception.empty()) - { - stream << "\n\n" << exception; - } - - std::string msg = stream.str(); + std::cerr << msg << "\n\n" << exception << std::endl; SDL_MessageBoxButtonData btns[] = { #ifdef WIN32 @@ -320,7 +313,7 @@ ErrorHandler::error_dialog_exception(const std::string& exception) SDL_MESSAGEBOX_ERROR, // flags nullptr, // window "Error", // title - msg.c_str(), // message + msg, // message SDL_arraysize(btns), // numbuttons btns, // buttons nullptr // colorscheme