1#[cfg(feature = "encoding-bech32")]
4#[derive(Clone, Copy, Debug, PartialEq, Eq, thiserror::Error)]
6pub enum Bech32EncodingError {
7 #[error("invalid Human-Readable Part (HRP)")]
8 InvalidHrp,
9 #[error("encoding operation failed")]
10 EncodingFailed,
11}
12
13#[derive(Debug, thiserror::Error)]
15#[error("slice length mismatch: expected {expected_len} bytes, got {actual_len} bytes")]
16pub struct FromSliceError {
17 pub(crate) actual_len: usize,
18 pub(crate) expected_len: usize,
19}
20
21impl FromSliceError {
22 pub(crate) fn new(actual_len: usize, expected_len: usize) -> Self {
24 Self {
25 actual_len,
26 expected_len,
27 }
28 }
29}