Expand description
Errors for conveniently attaching status codes to error cases.
use api_err::{CategoryExt, Context};
fn add_one(request: &str) -> api_err::Result<String> {
   let input = request.parse::<i64>().bad_request()?;
   let output = input.checked_add(1).context("Input too large").bad_request()?;
   Ok(output.to_string())
}Errors without a category attached default to the “Internal Server”-like error.
Structs§
- Error
- Core error type.
Enums§
- Category
- What type of error this is. Roughly corresponds to HTTP error statuses.
Traits§
- CategoryExt 
- Convenience trait for easily adding categories to errors.
- Context
- anyhow::Context-like trait for adding contexts and getting Errors.
Type Aliases§
- Result
- std::result::Result bound to Error.