err-ctx 0.2.3

Contextual error reporting helpers
Documentation
  • Coverage
  • 62.5%
    5 out of 8 items documented1 out of 8 items with examples
  • Size
  • Source code size: 3.32 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.54 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Ralith/err-ctx
    2 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Ralith

Minimalist helper library for providing contextual errors that display in the traditional "context: cause" format. Useful for cases where the primary goal of a Result is to convey detailed diagnostics to a user.

Pairs well with type Result<T> = std::result::Result<T, Box<std::error::Error + Send + Sync>>;

use std::fs;
use err_ctx::ResultExt;
let result = fs::read("foo.txt").ctx("reading foo.txt");
assert!(result.unwrap_err().to_string().starts_with("reading foo.txt: "));