diff options
author | dwight <dwight@10gen.com> | 2011-02-09 00:02:42 -0500 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2011-02-09 00:04:52 -0500 |
commit | 9f02a6260ee09bdc72d50c96a19cbaf9477ffb8e (patch) | |
tree | ac5f5a05f8a821a9959c2e72b6824db2764902f9 /s | |
parent | 446bc312751cfa27a89fa419b7fc93991c418939 (diff) | |
download | mongo-9f02a6260ee09bdc72d50c96a19cbaf9477ffb8e.tar.gz |
trap top level exceptions
Diffstat (limited to 's')
-rw-r--r-- | s/server.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/s/server.cpp b/s/server.cpp index 60e010052cd..a71bbf48d2b 100644 --- a/s/server.cpp +++ b/s/server.cpp @@ -184,7 +184,7 @@ using namespace mongo; namespace po = boost::program_options; -int main(int argc, char* argv[]) { +int _main(int argc, char* argv[]) { static StaticObserver staticObserver; mongosCommand = argv[0]; @@ -330,6 +330,23 @@ int main(int argc, char* argv[]) { dbexit( EXIT_CLEAN ); return 0; } +int main(int argc, char* argv[]) { + try { + return _main(argc, argv); + } + catch(DBException& e) { + cout << "uncaught exception in mongos main:" << endl; + cout << e.toString() << endl; + } + catch(std::exception& e) { + cout << "uncaught exception in mongos main:" << endl; + cout << e.what() << endl; + } + catch(...) { + cout << "uncaught exception in mongos main" << endl; + } + return 20; +} #undef exit void mongo::dbexit( ExitCode rc, const char *why, bool tryToGetLock ) { |