]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: display boost::program_options errors
authorLoic Dachary <loic-201408@dachary.org>
Wed, 17 Sep 2014 13:43:17 +0000 (15:43 +0200)
committerLoic Dachary <loic-201408@dachary.org>
Wed, 8 Oct 2014 06:59:15 +0000 (08:59 +0200)
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 <loic-201408@dachary.org>
src/tools/ceph_monstore_tool.cc
src/tools/ceph_objectstore_tool.cc
src/tools/ceph_osdomap_tool.cc

index c5cb0e1152e5625c34f1332a902ba73340429ef3..547f86d96ac9a2298faa701a9683513b4420d050 100644 (file)
@@ -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;
   }
 
index 827874f704624b6b16f5bce8565da20a34a1f8f9..3d09f6e81f39745aa8af005af302b0159b42072f 100644 (file)
@@ -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")) {
index 3e4cae28396b86ce0a6a3e2b9e439feedbfe6ca1..191cb08983ee959309585c7ce7eeea50d22ea61d 100644 (file)
@@ -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;
   }