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)]
9#[non_exhaustive]
10pub enum HexError {
11 /// Hex input must contain two lowercase hexadecimal characters per byte.
12 #[error("odd-length hex input")]
13 OddLength,
14
15 /// The decoder accepts only canonical lowercase hex.
16 #[error("uppercase hex input")]
17 Uppercase,
18
19 /// The input contained a byte outside `0-9` or `a-f`.
20 #[error("invalid hex input")]
21 InvalidCharacter,
22}