Skip to content

Commit

Permalink
make catching at game end optional
Browse files Browse the repository at this point in the history
for debugging purposes these are annoying since the OS usualy gives a better error message (stacktrace etc) on "crash" than on a catched exception + return.
  • Loading branch information
gfgtdf committed Jun 10, 2014
1 parent a1c859a commit 469eabb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/game.cpp
Expand Up @@ -786,9 +786,11 @@ int main(int argc, char** argv)
} catch(const char * e) {
std::cerr << "Caught a string thrown as an exception: " << e << std::endl;
return 1;
#if !defined(NO_CATCH_AT_GAME_END)
} catch(...) { //Added this to ensure that even when we terminate with `throw 42`, the exception is caught and all destructors are actually called.
std::cerr << "Caught unspecified general exception. Terminating." << std::endl; //Apparently, some compilers will simply terminate without
return 1; //calling destructors if there is no one to catch it at all.
#endif
}

return 0;
Expand Down

0 comments on commit 469eabb

Please sign in to comment.