codec_hex/error.rs
1// SPDX-FileCopyrightText: 2026 ReallyMe LLC
2//
3// SPDX-License-Identifier: MIT OR Apache-2.0
4
5use thiserror::Error;
6
7/// Error returned when canonical lowercase hex decoding fails.
8#[derive(Debug, Error, Eq, PartialEq)]
9#[non_exhaustive]
10pub enum HexError {
11 /// The output buffer cannot hold the requested hexadecimal text.
12 #[error("hex output capacity exceeded")]
13 OutputCapacityExceeded,
14
15 /// Hex input must contain two lowercase hexadecimal characters per byte.
16 #[error("odd-length hex input")]
17 OddLength,
18
19 /// The decoder accepts only canonical lowercase hex.
20 #[error("uppercase hex input")]
21 Uppercase,
22
23 /// The input contained a byte outside `0-9` or `a-f`.
24 #[error("invalid hex input")]
25 InvalidCharacter,
26}