clux / lq

jq compatible yq/tq implementation in rust
Apache License 2.0
21 stars 1 forks source link

add better errors from deserialize #23

Open clux opened 1 year ago

clux commented 1 year ago

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:

clux commented 1 year ago

alternative; https://github.com/eopb/serde_json_path_to_error if it implements the various wrappers (as requested in its issues)