tokn_headers/error.rs
1//! Errors produced by the headers crate.
2
3use smol_str::SmolStr;
4use thiserror::Error;
5
6/// All errors that can be produced when parsing or building headers via the
7/// schema layer.
8#[derive(Debug, Error, Clone, PartialEq, Eq)]
9pub enum Error {
10 /// A required header was absent from the input map.
11 #[error("required header missing: {name}")]
12 MissingHeader { name: SmolStr },
13
14 /// A header was present but its value did not match the expected shape.
15 #[error("invalid value for header {name}: {value:?} ({message})")]
16 InvalidValue {
17 name: SmolStr,
18 value: SmolStr,
19 message: SmolStr,
20 },
21}