Expand description
Where in a serde_json::Value a deserialization error happened, found
after the fact from the error message.
A path-tracking deserializer (serde_path_to_error) wraps every
deserializer call and is instantiated again for every type it parses (≈ 180
KiB of a gateway binary for the node configs alone). Errors are rare and
the input is at hand, so this module recovers the path once, without
generics: serde’s standard messages name the offending field, variant or
value (unknown field x, `missing field `x, unknown variant v``,
invalid type: string "s", expected …, invalid length 3, expected …), and
the tree is searched for it in document order. When the message names
nothing searchable (a custom error, or a map or sequence that occurs more
than once) the path is the root, and the message alone still says what is
wrong.
Functions§
- error_
path - Path of the value
error(from deserializingroot) is about; the root when it cannot be told. - error_
path_ text error_pathin theserde_path_to_errornotation:.for the root, elsevariables[0].value_selector.