This allows e.g. raw buffer constructors to provide more specific
information about what failed, as well as a useful error string
automatically.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
return buffer_cached_crc_adjusted.read();
}
+ buffer::error_code::error_code(int error) :
+ buffer::malformed_input(cpp_strerror(error).c_str()), code(error) {}
class buffer::raw {
public:
private:
char buf[256];
};
+ struct error_code : public malformed_input {
+ explicit error_code(int error);
+ int code;
+ };
/// total bytes allocated