error_status 0.1.0

Model common error context with HTTP 4xx and 5xx code
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::io::{self, ErrorKind};

use anyhow::Result;
use error_status::ResultExt;

fn find_file() -> Result<(), io::Error> {
    Err(ErrorKind::NotFound.into())
}

fn main() -> Result<()> {
    find_file()
        .not_found("Failed to read file")
        .internal_error("Config file is not available")?;
    Ok(())
}