THISCTX

A simple crate work with thiserror to create errors with contexts, inspired by snafu.

Examples

```rust use std::fs; use std::path::{Path, PathBuf}; use thisctx::{thisctx, ResultExt}; use thiserror::Error;

thisctx! { #[derive(Debug, Error)] pub enum Error { #[error("I/O failed '{}': {src}", .ctx.0.display())] IoFaild { #[source] @source src: std::io::Error, @context ctx: #[derive(Debug)] struct (PathBuf), }, } }

fn loadconfig(path: &Path) -> Result { fs::readto_string(path).context(IoFaild(path)) } ```

License

This software is released under the MIT License.