mirror of
https://github.com/nlohmann/json
synced 2024-12-17 22:51:07 +00:00
🚨 fix warning
This commit is contained in:
parent
bb2468a52c
commit
751b93652f
@ -2048,7 +2048,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
auto it = m_data.m_value.object->find(std::forward<KeyType>(key));
|
||||
if (it == m_data.m_value.object->end())
|
||||
{
|
||||
JSON_THROW(out_of_range::create(403, detail::concat("key '", string_t(std::forward<KeyType>(key)), "' not found"), this));
|
||||
JSON_THROW(out_of_range::create(403, "key not found (key is an rvalue and cannot be shown)", this));
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
@ -70,11 +70,11 @@ TEST_CASE_TEMPLATE("element access 2", Json, nlohmann::json, nlohmann::ordered_j
|
||||
SECTION("access outside bounds")
|
||||
{
|
||||
CHECK_THROWS_WITH_AS(j.at("foo"), "[json.exception.out_of_range.403] key not found (key is an rvalue and cannot be shown)", typename Json::out_of_range&);
|
||||
CHECK_THROWS_WITH_AS(j_const.at("foo"), "[json.exception.out_of_range.403] key 'foo' not found", typename Json::out_of_range&);
|
||||
CHECK_THROWS_WITH_AS(j_const.at("foo"), "[json.exception.out_of_range.403] key not found (key is an rvalue and cannot be shown)", typename Json::out_of_range&);
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
CHECK_THROWS_WITH_AS(j.at(std::string_view("foo")), "[json.exception.out_of_range.403] key not found (key is an rvalue and cannot be shown)", typename Json::out_of_range&);
|
||||
CHECK_THROWS_WITH_AS(j_const.at(std::string_view("foo")), "[json.exception.out_of_range.403] key 'foo' not found", typename Json::out_of_range&);
|
||||
CHECK_THROWS_WITH_AS(j_const.at(std::string_view("foo")), "[json.exception.out_of_range.403] key not found (key is an rvalue and cannot be shown)", typename Json::out_of_range&);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_TYPE_INTRU
|
||||
// check exception in case of missing field
|
||||
json j = json(p1);
|
||||
j.erase("age");
|
||||
CHECK_THROWS_WITH_AS(j.get<T>(), "[json.exception.out_of_range.403] key 'age' not found", json::out_of_range);
|
||||
CHECK_THROWS_WITH_AS(j.get<T>(), "[json.exception.out_of_range.403] key not found (key is an rvalue and cannot be shown)", json::out_of_range);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user