utils: Improve storage_io_exception error message

Make storage_io_exception exception error message less cryptic by
actually including the human-readable error message from
std::system_error...

Before:

  nodetool: Scylla API server HTTP POST to URL '/storage_service/snapshots' failed: Storage io error errno: 2

After:

  nodetool: Scylla API server HTTP POST to URL '/storage_service/snapshots' failed: Storage I/O error: 2: No such file or directory

We can improve this further by including the name of the file that the I/O
error happened on.
Message-Id: <1465452061-15474-1-git-send-email-penberg@scylladb.com>
This commit is contained in:
Pekka Enberg
2016-06-09 09:01:01 +03:00
committed by Tomasz Grabiec
parent d5a2d7a88d
commit 02d033667a

View File

@@ -35,10 +35,9 @@ private:
std::string _what;
public:
storage_io_error(std::system_error& e) noexcept
{
_code = e.code();
_what = std::string("Storage io error errno: ") + std::to_string(_code.value());
}
: _code{e.code()}
, _what{std::string("Storage I/O error: ") + std::to_string(e.code().value()) + ": " + e.what()}
{ }
virtual const char* what() const noexcept override {
return _what.c_str();