diff options
-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 ) { |