1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-21 04:22:05 +03:00

🔨 added user-defined exception 109

This exception occurs when a JSON pointer contains an array index that
can not be converted into a number.
This commit is contained in:
Niels Lohmann
2017-03-03 12:54:37 +01:00
parent b86d2148ef
commit 776758d7a2
3 changed files with 99 additions and 27 deletions

View File

@ -262,7 +262,9 @@ TEST_CASE("JSON pointers")
"[json.exception.parse_error.106] parse error: array index '01' must not begin with '0'");
// error with incorrect numbers
CHECK_THROWS_AS(j["/one"_json_pointer] = 1, std::invalid_argument);
CHECK_THROWS_AS(j["/one"_json_pointer] = 1, json::parse_error);
CHECK_THROWS_WITH(j["/one"_json_pointer] = 1,
"[json.exception.parse_error.109] parse error: array index 'one' is not a number");
// assign to "-"
j["/-"_json_pointer] = 99;