Skip to content

Commit

Permalink
Error handler: Print fatal exceptions to command line
Browse files Browse the repository at this point in the history
  • Loading branch information
Vankata453 authored Aug 15, 2024
1 parent 3e0030c commit 2d92941
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/supertux/error_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

1 comment on commit 2d92941

@MatusGuy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By doing this, you've removed exception from msg. You can revert this commit and just print msg right after it's defined

Please sign in to comment.