1
0
mirror of https://github.com/nlohmann/json synced 2024-11-23 20:40:08 +00:00

🔨 added user-defined exceptions 106-108

These exceptions occur when JSON pointers are malformed.
This commit is contained in:
Niels Lohmann 2017-03-03 11:56:58 +01:00
parent 06815d274e
commit b86d2148ef
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
4 changed files with 73 additions and 66 deletions

View File

@ -1109,9 +1109,9 @@ class basic_json
json.exception.[parse_error](@ref parse_error).103 | `"parse error: code points above 0x10FFFF are invalid"` | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid.
json.exception.[parse_error](@ref parse_error).104 | `"parse error: JSON patch must be an array of objects"` | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects.
json.exception.[parse_error](@ref parse_error).105 | `"parse error: operation must have string member 'op'"` | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors.
json.exception.[parse_error](@ref parse_error).106 | "parse error: array index must not begin with '0'" | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number wihtout a leading `0`.
json.exception.[parse_error](@ref parse_error).107 | "parse error: JSON pointer must be empty or begin with '/'" | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character.
json.exception.[parse_error](@ref parse_error).108 | "parse error: escape character '~' must be followed with '0' or '1'" | In a JSON Pointer, only `~0` and `~1` are valid escape sequences.
json.exception.[parse_error](@ref parse_error).106 | `"parse error: array index '01' must not begin with '0'"` | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number wihtout a leading `0`.
json.exception.[parse_error](@ref parse_error).107 | `"parse error: JSON pointer must be empty or begin with '/' - was: 'foo'"` | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character.
json.exception.[parse_error](@ref parse_error).108 | `"parse error: escape character '~' must be followed with '0' or '1'"` | In a JSON Pointer, only `~0` and `~1` are valid escape sequences.
json.exception.[parse_error](@ref parse_error).109 | "parse error: array index 'one' is not a number" | A JSON Pointer array index must be a number.
json.exception.[invalid_iterator](@ref invalid_iterator).201 | "iterators are not compatible" | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid.
json.exception.[invalid_iterator](@ref invalid_iterator).202 | "iterator does not fit current value" | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.
@ -11918,12 +11918,12 @@ basic_json_parser_74:
empty string is assumed which references the whole JSON
value
@throw std::domain_error if reference token is nonempty and does not
@throw parse_error.107 if reference token is nonempty and does not
begin with a slash (`/`); example: `"JSON pointer must be empty or
begin with /"`
@throw std::domain_error if a tilde (`~`) is not followed by `0`
(representing `~`) or `1` (representing `/`); example: `"escape error:
~ must be followed with 0 or 1"`
begin with / - was: 'foo'"`
@throw parse_error.108 if a tilde (`~`) is not followed by `0`
(representing `~`) or `1` (representing `/`); example: `"escape
character '~' must be followed with '0' or '1'"`
@liveexample{The example shows the construction several valid JSON
pointers as well as the exceptional behavior.,json_pointer}
@ -12074,7 +12074,7 @@ basic_json_parser_74:
@complexity Linear in the length of the JSON pointer.
@throw std::out_of_range if the JSON pointer can not be resolved
@throw std::domain_error if an array index begins with '0'
@throw parse_error.106 if an array index begins with '0'
@throw std::invalid_argument if an array index was not a number
*/
reference get_unchecked(pointer ptr) const
@ -12118,7 +12118,7 @@ basic_json_parser_74:
// error condition (cf. RFC 6901, Sect. 4)
if (reference_token.size() > 1 and reference_token[0] == '0')
{
JSON_THROW(std::domain_error("array index must not begin with '0'"));
JSON_THROW(parse_error(106, 0, "array index '" + reference_token + "' must not begin with '0'"));
}
if (reference_token == "-")
@ -12170,7 +12170,7 @@ basic_json_parser_74:
// error condition (cf. RFC 6901, Sect. 4)
if (reference_token.size() > 1 and reference_token[0] == '0')
{
JSON_THROW(std::domain_error("array index must not begin with '0'"));
JSON_THROW(parse_error(106, 0, "array index '" + reference_token + "' must not begin with '0'"));
}
// note: at performs range check
@ -12222,7 +12222,7 @@ basic_json_parser_74:
// error condition (cf. RFC 6901, Sect. 4)
if (reference_token.size() > 1 and reference_token[0] == '0')
{
JSON_THROW(std::domain_error("array index must not begin with '0'"));
JSON_THROW(parse_error(106, 0, "array index '" + reference_token + "' must not begin with '0'"));
}
// use unchecked array access
@ -12266,7 +12266,7 @@ basic_json_parser_74:
// error condition (cf. RFC 6901, Sect. 4)
if (reference_token.size() > 1 and reference_token[0] == '0')
{
JSON_THROW(std::domain_error("array index must not begin with '0'"));
JSON_THROW(parse_error(106, 0, "array index '" + reference_token + "' must not begin with '0'"));
}
// note: at performs range check
@ -12298,7 +12298,7 @@ basic_json_parser_74:
// check if nonempty reference string begins with slash
if (reference_string[0] != '/')
{
JSON_THROW(std::domain_error("JSON pointer must be empty or begin with '/'"));
JSON_THROW(parse_error(107, 1, "JSON pointer must be empty or begin with '/' - was: '" + reference_string + "'"));
}
// extract the reference tokens:
@ -12333,7 +12333,7 @@ basic_json_parser_74:
(reference_token[pos + 1] != '0' and
reference_token[pos + 1] != '1'))
{
JSON_THROW(std::domain_error("escape error: '~' must be followed with '0' or '1'"));
JSON_THROW(parse_error(108, 0, "escape character '~' must be followed with '0' or '1'"));
}
}

View File

@ -1109,9 +1109,9 @@ class basic_json
json.exception.[parse_error](@ref parse_error).103 | `"parse error: code points above 0x10FFFF are invalid"` | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid.
json.exception.[parse_error](@ref parse_error).104 | `"parse error: JSON patch must be an array of objects"` | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects.
json.exception.[parse_error](@ref parse_error).105 | `"parse error: operation must have string member 'op'"` | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors.
json.exception.[parse_error](@ref parse_error).106 | "parse error: array index must not begin with '0'" | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number wihtout a leading `0`.
json.exception.[parse_error](@ref parse_error).107 | "parse error: JSON pointer must be empty or begin with '/'" | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character.
json.exception.[parse_error](@ref parse_error).108 | "parse error: escape character '~' must be followed with '0' or '1'" | In a JSON Pointer, only `~0` and `~1` are valid escape sequences.
json.exception.[parse_error](@ref parse_error).106 | `"parse error: array index '01' must not begin with '0'"` | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number wihtout a leading `0`.
json.exception.[parse_error](@ref parse_error).107 | `"parse error: JSON pointer must be empty or begin with '/' - was: 'foo'"` | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character.
json.exception.[parse_error](@ref parse_error).108 | `"parse error: escape character '~' must be followed with '0' or '1'"` | In a JSON Pointer, only `~0` and `~1` are valid escape sequences.
json.exception.[parse_error](@ref parse_error).109 | "parse error: array index 'one' is not a number" | A JSON Pointer array index must be a number.
json.exception.[invalid_iterator](@ref invalid_iterator).201 | "iterators are not compatible" | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid.
json.exception.[invalid_iterator](@ref invalid_iterator).202 | "iterator does not fit current value" | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.
@ -10951,12 +10951,12 @@ class basic_json
empty string is assumed which references the whole JSON
value
@throw std::domain_error if reference token is nonempty and does not
@throw parse_error.107 if reference token is nonempty and does not
begin with a slash (`/`); example: `"JSON pointer must be empty or
begin with /"`
@throw std::domain_error if a tilde (`~`) is not followed by `0`
(representing `~`) or `1` (representing `/`); example: `"escape error:
~ must be followed with 0 or 1"`
begin with / - was: 'foo'"`
@throw parse_error.108 if a tilde (`~`) is not followed by `0`
(representing `~`) or `1` (representing `/`); example: `"escape
character '~' must be followed with '0' or '1'"`
@liveexample{The example shows the construction several valid JSON
pointers as well as the exceptional behavior.,json_pointer}
@ -11107,7 +11107,7 @@ class basic_json
@complexity Linear in the length of the JSON pointer.
@throw std::out_of_range if the JSON pointer can not be resolved
@throw std::domain_error if an array index begins with '0'
@throw parse_error.106 if an array index begins with '0'
@throw std::invalid_argument if an array index was not a number
*/
reference get_unchecked(pointer ptr) const
@ -11151,7 +11151,7 @@ class basic_json
// error condition (cf. RFC 6901, Sect. 4)
if (reference_token.size() > 1 and reference_token[0] == '0')
{
JSON_THROW(std::domain_error("array index must not begin with '0'"));
JSON_THROW(parse_error(106, 0, "array index '" + reference_token + "' must not begin with '0'"));
}
if (reference_token == "-")
@ -11203,7 +11203,7 @@ class basic_json
// error condition (cf. RFC 6901, Sect. 4)
if (reference_token.size() > 1 and reference_token[0] == '0')
{
JSON_THROW(std::domain_error("array index must not begin with '0'"));
JSON_THROW(parse_error(106, 0, "array index '" + reference_token + "' must not begin with '0'"));
}
// note: at performs range check
@ -11255,7 +11255,7 @@ class basic_json
// error condition (cf. RFC 6901, Sect. 4)
if (reference_token.size() > 1 and reference_token[0] == '0')
{
JSON_THROW(std::domain_error("array index must not begin with '0'"));
JSON_THROW(parse_error(106, 0, "array index '" + reference_token + "' must not begin with '0'"));
}
// use unchecked array access
@ -11299,7 +11299,7 @@ class basic_json
// error condition (cf. RFC 6901, Sect. 4)
if (reference_token.size() > 1 and reference_token[0] == '0')
{
JSON_THROW(std::domain_error("array index must not begin with '0'"));
JSON_THROW(parse_error(106, 0, "array index '" + reference_token + "' must not begin with '0'"));
}
// note: at performs range check
@ -11331,7 +11331,7 @@ class basic_json
// check if nonempty reference string begins with slash
if (reference_string[0] != '/')
{
JSON_THROW(std::domain_error("JSON pointer must be empty or begin with '/'"));
JSON_THROW(parse_error(107, 1, "JSON pointer must be empty or begin with '/' - was: '" + reference_string + "'"));
}
// extract the reference tokens:
@ -11366,7 +11366,7 @@ class basic_json
(reference_token[pos + 1] != '0' and
reference_token[pos + 1] != '1'))
{
JSON_THROW(std::domain_error("escape error: '~' must be followed with '0' or '1'"));
JSON_THROW(parse_error(108, 0, "escape character '~' must be followed with '0' or '1'"));
}
}

View File

@ -686,7 +686,7 @@ TEST_CASE("JSON patch")
json patch = {{{"foo", "bar"}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation must have member 'op'");
"[json.exception.parse_error.105] parse error: operation must have member 'op'");
}
SECTION("non-string 'op'")
@ -695,7 +695,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", 1}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation must have string member 'op'");
"[json.exception.parse_error.105] parse error: operation must have string member 'op'");
}
SECTION("invalid operation")
@ -704,7 +704,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "foo"}, {"path", ""}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation value 'foo' is invalid");
"[json.exception.parse_error.105] parse error: operation value 'foo' is invalid");
}
}
@ -716,7 +716,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "add"}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'add' must have member 'path'");
"[json.exception.parse_error.105] parse error: operation 'add' must have member 'path'");
}
SECTION("non-string 'path'")
@ -725,7 +725,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "add"}, {"path", 1}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'add' must have string member 'path'");
"[json.exception.parse_error.105] parse error: operation 'add' must have string member 'path'");
}
SECTION("missing 'value'")
@ -734,7 +734,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "add"}, {"path", ""}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'add' must have member 'value'");
"[json.exception.parse_error.105] parse error: operation 'add' must have member 'value'");
}
SECTION("invalid array index")
@ -754,7 +754,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "remove"}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'remove' must have member 'path'");
"[json.exception.parse_error.105] parse error: operation 'remove' must have member 'path'");
}
SECTION("non-string 'path'")
@ -763,7 +763,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "remove"}, {"path", 1}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'remove' must have string member 'path'");
"[json.exception.parse_error.105] parse error: operation 'remove' must have string member 'path'");
}
SECTION("nonexisting target location (array)")
@ -799,7 +799,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "replace"}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'replace' must have member 'path'");
"[json.exception.parse_error.105] parse error: operation 'replace' must have member 'path'");
}
SECTION("non-string 'path'")
@ -808,7 +808,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "replace"}, {"path", 1}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'replace' must have string member 'path'");
"[json.exception.parse_error.105] parse error: operation 'replace' must have string member 'path'");
}
SECTION("missing 'value'")
@ -817,7 +817,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "replace"}, {"path", ""}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'replace' must have member 'value'");
"[json.exception.parse_error.105] parse error: operation 'replace' must have member 'value'");
}
SECTION("nonexisting target location (array)")
@ -845,7 +845,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "move"}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'move' must have member 'path'");
"[json.exception.parse_error.105] parse error: operation 'move' must have member 'path'");
}
SECTION("non-string 'path'")
@ -854,7 +854,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "move"}, {"path", 1}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'move' must have string member 'path'");
"[json.exception.parse_error.105] parse error: operation 'move' must have string member 'path'");
}
SECTION("missing 'from'")
@ -863,7 +863,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "move"}, {"path", ""}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'move' must have member 'from'");
"[json.exception.parse_error.105] parse error: operation 'move' must have member 'from'");
}
SECTION("non-string 'from'")
@ -872,7 +872,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "move"}, {"path", ""}, {"from", 1}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'move' must have string member 'from'");
"[json.exception.parse_error.105] parse error: operation 'move' must have string member 'from'");
}
SECTION("nonexisting from location (array)")
@ -900,7 +900,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "copy"}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'copy' must have member 'path'");
"[json.exception.parse_error.105] parse error: operation 'copy' must have member 'path'");
}
SECTION("non-string 'path'")
@ -909,7 +909,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "copy"}, {"path", 1}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'copy' must have string member 'path'");
"[json.exception.parse_error.105] parse error: operation 'copy' must have string member 'path'");
}
SECTION("missing 'from'")
@ -918,7 +918,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "copy"}, {"path", ""}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'copy' must have member 'from'");
"[json.exception.parse_error.105] parse error: operation 'copy' must have member 'from'");
}
SECTION("non-string 'from'")
@ -927,7 +927,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "copy"}, {"path", ""}, {"from", 1}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'copy' must have string member 'from'");
"[json.exception.parse_error.105] parse error: operation 'copy' must have string member 'from'");
}
SECTION("nonexisting from location (array)")
@ -955,7 +955,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "test"}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'test' must have member 'path'");
"[json.exception.parse_error.105] parse error: operation 'test' must have member 'path'");
}
SECTION("non-string 'path'")
@ -964,7 +964,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "test"}, {"path", 1}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'test' must have string member 'path'");
"[json.exception.parse_error.105] parse error: operation 'test' must have string member 'path'");
}
SECTION("missing 'value'")
@ -973,7 +973,7 @@ TEST_CASE("JSON patch")
json patch = {{{"op", "test"}, {"path", ""}}};
CHECK_THROWS_AS(j.patch(patch), json::parse_error);
CHECK_THROWS_WITH(j.patch(patch),
"[json.exception.parse_error.105] parse error: operation 'test' must have member 'value'");
"[json.exception.parse_error.105] parse error: operation 'test' must have member 'value'");
}
}
}

View File

@ -36,14 +36,17 @@ TEST_CASE("JSON pointers")
{
SECTION("errors")
{
CHECK_THROWS_AS(json::json_pointer("foo"), std::domain_error);
CHECK_THROWS_WITH(json::json_pointer("foo"), "JSON pointer must be empty or begin with '/'");
CHECK_THROWS_AS(json::json_pointer("foo"), json::parse_error);
CHECK_THROWS_WITH(json::json_pointer("foo"),
"[json.exception.parse_error.107] parse error at 1: JSON pointer must be empty or begin with '/' - was: 'foo'");
CHECK_THROWS_AS(json::json_pointer("/~~"), std::domain_error);
CHECK_THROWS_WITH(json::json_pointer("/~~"), "escape error: '~' must be followed with '0' or '1'");
CHECK_THROWS_AS(json::json_pointer("/~~"), json::parse_error);
CHECK_THROWS_WITH(json::json_pointer("/~~"),
"[json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1'");
CHECK_THROWS_AS(json::json_pointer("/~"), std::domain_error);
CHECK_THROWS_WITH(json::json_pointer("/~"), "escape error: '~' must be followed with '0' or '1'");
CHECK_THROWS_AS(json::json_pointer("/~"), json::parse_error);
CHECK_THROWS_WITH(json::json_pointer("/~"),
"[json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1'");
json::json_pointer p;
CHECK_THROWS_AS(p.top(), std::domain_error);
@ -245,14 +248,18 @@ TEST_CASE("JSON pointers")
CHECK(j == json({1, 13, 3, 33, nullptr, 55}));
// error with leading 0
CHECK_THROWS_AS(j["/01"_json_pointer], std::domain_error);
CHECK_THROWS_WITH(j["/01"_json_pointer], "array index must not begin with '0'");
CHECK_THROWS_AS(j_const["/01"_json_pointer], std::domain_error);
CHECK_THROWS_WITH(j_const["/01"_json_pointer], "array index must not begin with '0'");
CHECK_THROWS_AS(j.at("/01"_json_pointer), std::domain_error);
CHECK_THROWS_WITH(j.at("/01"_json_pointer), "array index must not begin with '0'");
CHECK_THROWS_AS(j_const.at("/01"_json_pointer), std::domain_error);
CHECK_THROWS_WITH(j_const.at("/01"_json_pointer), "array index must not begin with '0'");
CHECK_THROWS_AS(j["/01"_json_pointer], json::parse_error);
CHECK_THROWS_WITH(j["/01"_json_pointer],
"[json.exception.parse_error.106] parse error: array index '01' must not begin with '0'");
CHECK_THROWS_AS(j_const["/01"_json_pointer], json::parse_error);
CHECK_THROWS_WITH(j_const["/01"_json_pointer],
"[json.exception.parse_error.106] parse error: array index '01' must not begin with '0'");
CHECK_THROWS_AS(j.at("/01"_json_pointer), json::parse_error);
CHECK_THROWS_WITH(j.at("/01"_json_pointer),
"[json.exception.parse_error.106] parse error: array index '01' must not begin with '0'");
CHECK_THROWS_AS(j_const.at("/01"_json_pointer), json::parse_error);
CHECK_THROWS_WITH(j_const.at("/01"_json_pointer),
"[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);