pub fn parse_error_source(e: &dyn Display) -> Box<dyn Error + Send + Sync>Expand description
Redacts e via redact_parse_error_for_log and wraps the result as the boxed error
crate::error::DepsError::ParseError’s source field expects.
Centralizes the whole “redact, then wrap into an io::Error” step — not just the redaction
itself — as one call, deps_core::redact::parse_error_source(&e), in place of
Box::new(std::io::Error::other(redact_parse_error_for_log(&e.to_string()))) repeated at
each toml_span/yaml-rust2 map_err site. A future ecosystem crate adding a new parse-error
site is forced through the safe path by construction, rather than being able to copy an old,
unfixed Box::new(std::io::Error::other(e.to_string())) from elsewhere and reintroduce #1240.
§Examples
use deps_core::redact::parse_error_source;
let source = parse_error_source(&"duplicate key: `serde`");
assert_eq!(source.to_string(), "duplicate key: `serde`");