diff --git a/json/except.cpp b/json/except.cpp index 3bb1ac19..757ba427 100644 --- a/json/except.cpp +++ b/json/except.cpp @@ -16,6 +16,8 @@ #include "except.hpp" +#include "../format.hpp" + /////////////////////////////////////////////////////////////////////////////// json::parse_error::parse_error (const std::string &_what, size_t _line): @@ -34,6 +36,7 @@ json::parse_error::what (void) const noexcept /////////////////////////////////////////////////////////////////////////////// -json::key_error::key_error (std::string _what): - error (std::move (_what)) +json::key_error::key_error (std::string _key): + error (util::format::render ("missing key '%s'", _key)), + key (_key) { ; } diff --git a/json/except.hpp b/json/except.hpp index decd061d..6f18f9c2 100644 --- a/json/except.hpp +++ b/json/except.hpp @@ -54,6 +54,8 @@ namespace json { /// Exception class for invalid object indexing struct key_error : public error { explicit key_error (std::string); + + std::string key; }; }