1#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum RuneError {
6 RingTooSmall,
8 SignerIndexOutOfRange,
10 InconsistentRingParameter,
12 MalformedSignature,
14 MalformedChallenge,
16 MalformedPublicKey,
18 RejectionSamplingFailed,
20}
21
22impl std::fmt::Display for RuneError {
23 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24 match self {
25 Self::RingTooSmall => f.write_str("ring size is less than 2"),
26 Self::SignerIndexOutOfRange => f.write_str("signer index is out of range"),
27 Self::InconsistentRingParameter => {
28 f.write_str("public keys do not share the same ring parameter")
29 }
30 Self::MalformedSignature => f.write_str("signature has malformed structure"),
31 Self::MalformedChallenge => f.write_str("challenge polynomial is malformed"),
32 Self::MalformedPublicKey => f.write_str("public key has malformed structure"),
33 Self::RejectionSamplingFailed => {
34 f.write_str("rejection sampling failed within the attempt limit")
35 }
36 }
37 }
38}
39
40impl std::error::Error for RuneError {}