#[derive(Debug, Clone, PartialEq, Eq)]
pub enum RuneError {
RingTooSmall,
SignerIndexOutOfRange,
InconsistentRingParameter,
MalformedSignature,
MalformedChallenge,
MalformedPublicKey,
RejectionSamplingFailed,
}
impl std::fmt::Display for RuneError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::RingTooSmall => f.write_str("ring size is less than 2"),
Self::SignerIndexOutOfRange => f.write_str("signer index is out of range"),
Self::InconsistentRingParameter => {
f.write_str("public keys do not share the same ring parameter")
}
Self::MalformedSignature => f.write_str("signature has malformed structure"),
Self::MalformedChallenge => f.write_str("challenge polynomial is malformed"),
Self::MalformedPublicKey => f.write_str("public key has malformed structure"),
Self::RejectionSamplingFailed => {
f.write_str("rejection sampling failed within the attempt limit")
}
}
}
}
impl std::error::Error for RuneError {}