Skip to content

Commit

Permalink
Rewrite a couple of unwieldy comments in main()
Browse files Browse the repository at this point in the history
  • Loading branch information
irydacea committed Jul 4, 2014
1 parent ad58361 commit 6397598
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/wesnoth.cpp
Expand Up @@ -853,7 +853,8 @@ int main(int argc, char** argv)
} catch(std::bad_alloc&) {
std::cerr << "Ran out of memory. Aborted.\n";
return ENOMEM;
} catch(std::exception & e) { //Added this in case the others fall through.
} catch(std::exception & e) {
// Try to catch unexpected exceptions.
std::cerr << "Caught general exception: " << e.what() << std::endl;
return 1;
} catch(std::string & e) {
Expand All @@ -863,9 +864,12 @@ int main(int argc, char** argv)
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.
} catch(...) {
// Ensure that even when we terminate with `throw 42`, the exception
// is caught and all destructors are actually called. (Apparently,
// some compilers will simply terminate without calling destructors if
// the exception isn't caught.)
std::cerr << "Caught unspecified general exception. Terminating." << std::endl;
#endif
}

Expand Down

0 comments on commit 6397598

Please sign in to comment.