]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-dencoder: more helpful error message for messages
authorSage Weil <sage.weil@dreamhost.com>
Fri, 3 Feb 2012 05:05:37 +0000 (21:05 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 3 Feb 2012 05:06:39 +0000 (21:06 -0800)
If the type doesn't match, share what it was vs what you expected.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/test/encoding/ceph_dencoder.cc

index 890ec450e0560a2a9f88e9a3c93e13fd0271c3d1..ae9535d04239a17f50e04258a6c5742279ae0a76 100644 (file)
@@ -119,8 +119,11 @@ public:
       Message *n = decode_message(g_ceph_context, p);
       if (!n)
        throw std::runtime_error("failed to decode");
-      if (n->get_type() != m_object->get_type())
-       throw std::runtime_error("decoded incorrect type message");
+      if (n->get_type() != m_object->get_type()) {
+       stringstream ss;
+       ss << "decoded type " << n->get_type() << " instead of expected " << m_object->get_type();
+       throw std::runtime_error(ss.str());
+      }
       m_object->put();
       m_object = (T *)n;
     }