Rust Anyhow

anyhow is a rust library to type erase different error types. This simplifies error propagation in user code.

Context

We can wrap an anyhow::Result with additional context information with .context():

result.context("additional info")

There is also a lazy version .with_context():

result.with_context(|| format!("Failed to read instrs from {}", path.display()))

See Also