Skip to main content

render_anyhow_error

Function render_anyhow_error 

Source
pub fn render_anyhow_error(err: &Error, source_map: &SourceMap) -> String
Expand description

Renders an anyhow::Error chain produced by this crate, substituting snippet-bearing output for any ResolveError or ParseError layers.

For each layer in the chain, this calls ResolveError::highlight or ParseError::highlight to format typed errors with file/line/column and a source snippet. Other layers are formatted via their fmt::Display impl. Layers are joined with ": ", matching format!("{err:#}").

source_map must be the SourceMap in which every typed error’s spans are valid; combining typed errors from different source maps in one chain is unsupported.