Skip to main content

format_error

Function format_error 

Source
pub fn format_error(err: &Error, format: OutputFormat) -> String
Expand description

Format an error for display, matching the requested output format.

The Table branch reproduces this crate’s existing plain-text error format ("error: {err:#}", anyhow’s flattened Display chain), so plain-text users see the same text as before --output existed. The Json branch emits {"error": "<message>"} so scripted consumers never have to parse free-text stderr.