💥 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
|
|
@ -1077,10 +1077,10 @@ TEST_CASE("MessagePack")
|
|||
{
|
||||
CHECK_THROWS_AS(json::from_msgpack(std::vector<uint8_t>({0xc1})), json::parse_error&);
|
||||
CHECK_THROWS_WITH(json::from_msgpack(std::vector<uint8_t>({0xc1})),
|
||||
"[json.exception.parse_error.112] parse error at 1: error reading MessagePack; last byte: 0xc1");
|
||||
"[json.exception.parse_error.112] parse error at 1: error reading MessagePack; last byte: 0xC1");
|
||||
CHECK_THROWS_AS(json::from_msgpack(std::vector<uint8_t>({0xc6})), json::parse_error&);
|
||||
CHECK_THROWS_WITH(json::from_msgpack(std::vector<uint8_t>({0xc6})),
|
||||
"[json.exception.parse_error.112] parse error at 1: error reading MessagePack; last byte: 0xc6");
|
||||
"[json.exception.parse_error.112] parse error at 1: error reading MessagePack; last byte: 0xC6");
|
||||
}
|
||||
|
||||
SECTION("all unsupported bytes")
|
||||
|
|
@ -1106,7 +1106,7 @@ TEST_CASE("MessagePack")
|
|||
{
|
||||
CHECK_THROWS_AS(json::from_msgpack(std::vector<uint8_t>({0x81, 0xff, 0x01})), json::parse_error&);
|
||||
CHECK_THROWS_WITH(json::from_msgpack(std::vector<uint8_t>({0x81, 0xff, 0x01})),
|
||||
"[json.exception.parse_error.113] parse error at 2: expected a MessagePack string; last byte: 0xff");
|
||||
"[json.exception.parse_error.113] parse error at 2: expected a MessagePack string; last byte: 0xFF");
|
||||
}
|
||||
|
||||
SECTION("strict mode")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue