Skip to main content

ps_hash_core/
error.rs

1#![allow(clippy::module_name_repetitions)]
2
3use ps_ecc::{RSDecodeError, RSGenerateParityError};
4use thiserror::Error;
5
6#[derive(Clone, Debug, Error, PartialEq, Eq)]
7#[non_exhaustive]
8pub enum HashError {
9    #[error(transparent)]
10    RSGenerateParityError(#[from] RSGenerateParityError),
11    #[error("The digest is all zeros")]
12    ZeroDigest,
13}
14
15#[derive(Clone, Debug, Error, PartialEq, Eq)]
16#[non_exhaustive]
17pub enum HashValidationError {
18    #[error("Invalid Hash length: {0}")]
19    InvalidLength(usize),
20    #[error(transparent)]
21    RSDecodeError(#[from] RSDecodeError),
22    #[error("The digest is all zeros")]
23    ZeroDigest,
24}