use thiserror::Error;
pub type FastCryptoResult<T> = Result<T, FastCryptoError>;
#[derive(Clone, Debug, Error, Eq, PartialEq)]
pub enum FastCryptoError {
#[error("Invalid value was given to the function")]
InvalidInput,
#[error("Expected input of length at least {0}")]
InputTooShort(usize),
#[error("Expected input of length at most {0}")]
InputTooLong(usize),
#[error("Expected input of length exactly {0}")]
InputLengthWrong(usize),
#[error("Invalid signature was given to the function")]
InvalidSignature,
#[error("Invalid proof was given to the function")]
InvalidProof,
#[error("Not enough inputs were given to the function, retry with more")]
NotEnoughInputs,
#[error("Invalid message was given to the function")]
InvalidMessage,
#[error("Message should be ignored")]
IgnoredMessage,
#[error("General cryptographic error: {0}")]
GeneralError(String),
#[error("General cryptographic error")]
GeneralOpaqueError,
}
impl From<signature::Error> for FastCryptoError {
fn from(_: signature::Error) -> Self {
FastCryptoError::InvalidSignature
}
}