Skip to content

add better errors from deserialize #23

@clux

Description

@clux

want to let users more easily see where deserialise errors comes from.

Ideally you can add serde_path_to_error and swap out the deserializer calls with serde_path_to_error::deserialize(deserializer)

e.g.:

# original
let value: Type = serde_json::from_str(data)?
# replacement
let deserializer = &mut serde_json::Deserializer::from_str(data);
let value: Type = serde_path_to_error::deserialize(deserializer)?

There are some uncertainties here though:

  • will this work with readers? we use BufRead generally
  • will this work with singleton_map_recursive from serde_yaml? we need this to handle yaml tags

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions