]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/cmdparse: add bad_cmd_get exception
authorSage Weil <sage@redhat.com>
Thu, 2 Aug 2018 19:33:50 +0000 (14:33 -0500)
committerSage Weil <sage@redhat.com>
Sun, 5 Aug 2018 02:54:24 +0000 (21:54 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/cmdparse.h

index bcd1943a7f3a024146f0b37cb74cb5c12822c45f..81a46e4fb2dad593f4fed8a7b74a6737cd361572 100644 (file)
@@ -46,6 +46,16 @@ void handle_bad_get(CephContext *cct, const std::string& k, const char *name);
 
 std::string cmd_vartype_stringify(const cmd_vartype& v);
 
+struct bad_cmd_get : public std::exception {
+  std::string desc;
+  bad_cmd_get(const std::string& f, const cmdmap_t& cmdmap) {
+    desc = "bad or missing field '" + f + "'";
+  }
+  const char *what() const throw() override {
+    return desc.c_str();
+  }
+};
+
 template <typename T>
 bool
 cmd_getval(CephContext *cct, const cmdmap_t& cmdmap, const std::string& k, T& val)