1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! [](./LICENSE)
//! [](https://crates.io/crates/cdumay_http)
//! [](https://docs.rs/cdumay_http)
//! [](https://github.com/cdumay/cdumay_http)
//!
//! This crate provides structured mapping from HTTP status codes to custom application including error types using the [`cdumay_core`](https://docs.rs/cdumay_core/) crate. It is especially useful when you want to handle HTTP error responses in a standardized and extensible way.
//!
//! ## Features
//!
//! - Maps common HTTP status codes (300–511) to well-defined application-specific errors.
//! - Integrates seamlessly with the `cdumay_core` ecosystem.
//! - Allows contextual error data and custom messages.
//! - Supports conversion from `u16`
//!
//! ## Usage
//!
//! ### Define Error Kinds and Errors
//!
//! The `define_kinds!` macro associates each HTTP status code with:
//! - A numerical HTTP status code
//! - A descriptive error label
//!
//! The `define_errors!` macro maps those kinds into named error types (e.g., `NotFound`, `TooManyRequests`, etc.).
//!
//! ```rust
//! use std::collections::BTreeMap;
//! use serde_value::Value;
//! use cdumay_http::HTTPErrorConverter;
//!
//! let mut context = BTreeMap::new();
//! context.insert("url".to_string(), Value::String("https://example.com".to_string()));
//!
//! let error = HTTPErrorConverter::from_u16(404, context);
//! println!("{:?}", error);
//! ```
/// Provides utilities for mapping HTTP status codes to structured `cdumay_core::Error` types.
pub use *;