From: Loic Dachary Date: Wed, 17 Sep 2014 13:43:17 +0000 (+0200) Subject: tools: display boost::program_options errors X-Git-Tag: v0.88~91^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8e5b7acad15a1aacb8cc35b782642cc34d891657;p=ceph.git tools: display boost::program_options errors Instead of silently discarding them. Do not display the usage on error as it will probably hide the error message that shows before it. Signed-off-by: Loic Dachary --- diff --git a/src/tools/ceph_monstore_tool.cc b/src/tools/ceph_monstore_tool.cc index c5cb0e1152e5..547f86d96ac9 100644 --- a/src/tools/ceph_monstore_tool.cc +++ b/src/tools/ceph_monstore_tool.cc @@ -141,8 +141,8 @@ int main(int argc, char **argv) { parsed, vm); po::notify(vm); - } catch (...) { - cout << desc << std::endl; + } catch(po::error &e) { + std::cerr << e.what() << std::endl; return 1; } diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 827874f70462..3d09f6e81f39 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -1843,9 +1843,9 @@ int main(int argc, char **argv) po::command_line_parser(argc, argv).options(all).allow_unregistered().positional(pd).run(); po::store( parsed, vm); po::notify(vm); - } - catch(...) { - usage(desc); + } catch(po::error &e) { + std::cerr << e.what() << std::endl; + return 1; } if (vm.count("help")) { diff --git a/src/tools/ceph_osdomap_tool.cc b/src/tools/ceph_osdomap_tool.cc index 3e4cae28396b..191cb08983ee 100644 --- a/src/tools/ceph_osdomap_tool.cc +++ b/src/tools/ceph_osdomap_tool.cc @@ -49,8 +49,8 @@ int main(int argc, char **argv) { parsed, vm); po::notify(vm); - } catch (...) { - cout << desc << std::endl; + } catch(po::error &e) { + std::cerr << e.what() << std::endl; return 1; }