]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: NObjectIteratorImpl::get_next() throws std::system_error
authorCasey Bodley <cbodley@redhat.com>
Tue, 13 Nov 2018 20:44:15 +0000 (15:44 -0500)
committerCasey Bodley <cbodley@redhat.com>
Mon, 26 Nov 2018 19:34:47 +0000 (14:34 -0500)
this allows the catcher to retrieve the original error code

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/librados/librados_c.cc
src/librados/librados_cxx.cc
src/tools/rados/rados.cc

index e4bfc4e8d1bea47fee9fb3ae4132e09f3e0682fd..0494c9baa5baf9de35edf1f775bb70d22c7e05aa 100644 (file)
@@ -45,7 +45,6 @@ using std::map;
 using std::set;
 using std::vector;
 using std::list;
-using std::runtime_error;
 
 #define dout_subsys ceph_subsys_rados
 #undef dout_prefix
index 42deb1843e5b5aaf2f026c914a7ad52bc15d5910..41d6102e2657e29d572aa3bedd1a9432386ccb08 100644 (file)
@@ -41,6 +41,7 @@
 #include <vector>
 #include <list>
 #include <stdexcept>
+#include <system_error>
 
 #ifdef WITH_LTTNG
 #define TRACEPOINT_DEFINE
@@ -57,7 +58,6 @@ using std::map;
 using std::set;
 using std::vector;
 using std::list;
-using std::runtime_error;
 
 #define dout_subsys ceph_subsys_rados
 #undef dout_prefix
@@ -761,9 +761,8 @@ void librados::NObjectIteratorImpl::get_next()
     return;
   }
   else if (ret) {
-    ostringstream oss;
-    oss << "rados returned " << cpp_strerror(ret);
-    throw std::runtime_error(oss.str());
+    throw std::system_error(-ret, std::system_category(),
+                            "rados_nobjects_list_next");
   }
 
   if (cur_obj.impl == NULL)
index ff0a6748320be33d20fd1ed4a89c30a49cfa73c9..951b4f0b5e984e27e1b0547adef5cdd15a84f4e3 100644 (file)
@@ -1438,7 +1438,7 @@ static int do_cache_flush_evict_all(IoCtx& io_ctx, bool blocking)
       }
     }
   }
-  catch (const std::runtime_error& e) {
+  catch (const std::exception& e) {
     cerr << e.what() << std::endl;
     return -1;
   }
@@ -2437,7 +2437,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
          }
        }
       }
-      catch (const std::runtime_error& e) {
+      catch (const std::exception& e) {
        cerr << e.what() << std::endl;
        ret = -1;
        goto out;