💥 throwing an exception in case dump encounters a non-UTF-8 string #838
We had a lot of issues with failing roundtrips (i.e., parse errors from serializations) in case string were stored in the library that were not UTF-8 encoded. This PR adds an exception in this case.
This commit is contained in:
parent
383743c6c0
commit
569d275f65
6 changed files with 116 additions and 15 deletions
|
|
@ -1287,10 +1287,10 @@ TEST_CASE("CBOR")
|
|||
{
|
||||
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x1c})), json::parse_error&);
|
||||
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>({0x1c})),
|
||||
"[json.exception.parse_error.112] parse error at 1: error reading CBOR; last byte: 0x1c");
|
||||
"[json.exception.parse_error.112] parse error at 1: error reading CBOR; last byte: 0x1C");
|
||||
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xf8})), json::parse_error&);
|
||||
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>({0xf8})),
|
||||
"[json.exception.parse_error.112] parse error at 1: error reading CBOR; last byte: 0xf8");
|
||||
"[json.exception.parse_error.112] parse error at 1: error reading CBOR; last byte: 0xF8");
|
||||
}
|
||||
|
||||
SECTION("all unsupported bytes")
|
||||
|
|
@ -1348,7 +1348,7 @@ TEST_CASE("CBOR")
|
|||
{
|
||||
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0xa1, 0xff, 0x01})), json::parse_error&);
|
||||
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>({0xa1, 0xff, 0x01})),
|
||||
"[json.exception.parse_error.113] parse error at 2: expected a CBOR string; last byte: 0xff");
|
||||
"[json.exception.parse_error.113] parse error at 2: expected a CBOR string; last byte: 0xFF");
|
||||
}
|
||||
|
||||
SECTION("strict mode")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue