codec_hex/error.rs
1// SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
2//
3// SPDX-License-Identifier: Apache-2.0
4
5use thiserror::Error;
6
7/// Error returned when canonical lowercase hex decoding fails.
8#[derive(Debug, Error, Eq, PartialEq)]
9pub enum HexError {
10 /// Hex input must contain two lowercase hexadecimal characters per byte.
11 #[error("odd-length hex input")]
12 OddLength,
13
14 /// The decoder accepts only canonical lowercase hex.
15 #[error("uppercase hex input")]
16 Uppercase,
17
18 /// The input contained a byte outside `0-9` or `a-f`.
19 #[error("invalid hex input")]
20 InvalidCharacter,
21}