#define ENCODE_FINISH(bl) ENCODE_FINISH_NEW_COMPAT(bl, 0)
#define DECODE_ERR_OLDVERSION(func, v, compatv) \
- (std::string(func) + " no longer understand old encoding version " #v " < " + std::to_string(compatv))
+ (std::string(func) + " no longer understands old encoding version " #v " < " + std::to_string(compatv))
+
+#define DECODE_ERR_NO_COMPAT(func, code_v, v, compatv) \
+ ("Decoder at '" + std::string(func) + "' v=" + std::to_string(code_v) + \
+ " cannot decode v=" + std::to_string(v) + " minimal_decoder=" + std::to_string(compatv))
#define DECODE_ERR_PAST(func) \
(std::string(func) + " decode past end of struct encoding")
decode(struct_v, bl); \
decode(struct_compat, bl); \
if (v < struct_compat) \
- throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION(__PRETTY_FUNCTION__, v, struct_compat)); \
+ throw ::ceph::buffer::malformed_input(DECODE_ERR_NO_COMPAT(__PRETTY_FUNCTION__, v, struct_v, struct_compat)); \
__u32 struct_len; \
decode(struct_len, bl); \
if (struct_len > bl.get_remaining()) \
__u8 struct_compat; \
decode(struct_compat, bl); \
if (v < struct_compat) \
- throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION(__PRETTY_FUNCTION__, v, struct_compat)); \
+ throw ::ceph::buffer::malformed_input(DECODE_ERR_NO_COMPAT(__PRETTY_FUNCTION__, v, struct_v, struct_compat)); \
} else if (skip_v) { \
if (bl.get_remaining() < skip_v) \
throw ::ceph::buffer::malformed_input(DECODE_ERR_PAST(__PRETTY_FUNCTION__)); \
__u8 struct_compat; \
decode(struct_compat, bl); \
if (v < struct_compat) \
- throw ::ceph::buffer::malformed_input(DECODE_ERR_OLDVERSION( \
- __PRETTY_FUNCTION__, v, struct_compat)); \
+ throw ::ceph::buffer::malformed_input(DECODE_ERR_NO_COMPAT( \
+ __PRETTY_FUNCTION__, v, struct_v, struct_compat)); \
} \
unsigned struct_end = 0; \
if (struct_v >= lenv) { \