This commit is contained in:
nlohmann committed 2026-10-06 15:51:51 +00:00
1 parent 41e21ac50a
commit 148be4b157
19 files changed
+73 -15

No files matched your search

+12
View File
@@ -909,6 +909,18 @@ Example message
[json.exception.type_error.318] duplicate object key 'red'
```
### json.exception.type_error.321
A discarded value (one created by [`parse()`](https://json.nlohmann.me/api/basic_json/parse/index.md) with a callback that returns `false` for the value, or by default-constructing a [`basic_json`](https://json.nlohmann.me/api/basic_json/index.md) with [`value_t::discarded`](https://json.nlohmann.me/api/basic_json/value_t/index.md)) was passed to a binary serialization function, either directly or nested in an array or object. There is no way to represent a discarded value in CBOR, MessagePack, UBJSON, BJData, or BSON.
Example message
Serializing `[1, 2]` to CBOR, where the second element was discarded by a parser callback:
```
[json.exception.type_error.321] cannot serialize discarded value to CBOR
```
## Out of range
This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for instance, in the case of array indices or nonexisting object keys.