diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 949df15c..21421f8b 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -3173,7 +3173,7 @@ class basic_json return m_value.object->operator[](key); } - JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! @@ -3215,7 +3215,7 @@ class basic_json return m_value.object->find(key)->second; } - JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! @@ -3262,7 +3262,7 @@ class basic_json return m_value.object->operator[](key); } - JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! @@ -3305,7 +3305,7 @@ class basic_json return m_value.object->find(key)->second; } - JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index e60eed88..e1930959 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -14280,7 +14280,7 @@ class basic_json return m_value.object->operator[](key); } - JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! @@ -14322,7 +14322,7 @@ class basic_json return m_value.object->find(key)->second; } - JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! @@ -14369,7 +14369,7 @@ class basic_json return m_value.object->operator[](key); } - JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! @@ -14412,7 +14412,7 @@ class basic_json return m_value.object->find(key)->second; } - JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! diff --git a/test/src/unit-element_access2.cpp b/test/src/unit-element_access2.cpp index 8707c472..287a1a18 100644 --- a/test/src/unit-element_access2.cpp +++ b/test/src/unit-element_access2.cpp @@ -475,9 +475,9 @@ TEST_CASE("element access 2") CHECK_NOTHROW(j_nonobject2[json::object_t::key_type("foo")]); CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); - CHECK_THROWS_WITH(j_const_nonobject["foo"], "[json.exception.type_error.305] cannot use operator[] with a key-style argument with null"); + CHECK_THROWS_WITH(j_const_nonobject["foo"], "[json.exception.type_error.305] cannot use operator[] with a string argument with null"); CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with null"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with null"); } SECTION("boolean") @@ -489,13 +489,13 @@ TEST_CASE("element access 2") CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_WITH(j_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with boolean"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with boolean"); CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with boolean"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with boolean"); CHECK_THROWS_WITH(j_const_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with boolean"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with boolean"); CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with boolean"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with boolean"); } SECTION("string") @@ -507,13 +507,13 @@ TEST_CASE("element access 2") CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_WITH(j_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with string"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with string"); CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with string"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with string"); CHECK_THROWS_WITH(j_const_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with string"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with string"); CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with string"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with string"); } SECTION("array") @@ -525,12 +525,12 @@ TEST_CASE("element access 2") CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_WITH(j_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with array"); - CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], "[json.exception.type_error.305] cannot use operator[] with a key-style argument with array"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with array"); + CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], "[json.exception.type_error.305] cannot use operator[] with a string argument with array"); CHECK_THROWS_WITH(j_const_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with array"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with array"); CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with array"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with array"); } SECTION("number (integer)") @@ -542,13 +542,13 @@ TEST_CASE("element access 2") CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_WITH(j_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); CHECK_THROWS_WITH(j_const_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); } SECTION("number (unsigned)") @@ -560,13 +560,13 @@ TEST_CASE("element access 2") CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_WITH(j_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); CHECK_THROWS_WITH(j_const_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); } SECTION("number (floating-point)") @@ -578,13 +578,13 @@ TEST_CASE("element access 2") CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_WITH(j_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); CHECK_THROWS_WITH(j_const_nonobject["foo"], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], - "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number"); + "[json.exception.type_error.305] cannot use operator[] with a string argument with number"); } } }