structured_dstu4145/
error.rs1use core::fmt;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5#[non_exhaustive]
6pub enum Error {
7 UnsupportedDomain,
9 InvalidField,
11 InvalidDomain,
13 ValidationEvidenceRequired,
15 RandomSampleRefused,
17 InvalidKey,
19 InvalidEncoding,
21 InvalidDke,
23 InvalidOutputSize,
25 InputTooLong,
27}
28
29impl fmt::Display for Error {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 f.write_str(match self {
32 Self::UnsupportedDomain => "unsupported DSTU domain",
33 Self::InvalidField => "invalid DSTU field",
34 Self::InvalidDomain => "invalid DSTU domain",
35 Self::ValidationEvidenceRequired => "custom domain validation evidence required",
36 Self::RandomSampleRefused => "random sampling bound exhausted",
37 Self::InvalidKey => "invalid DSTU public key",
38 Self::InvalidEncoding => "invalid DSTU encoding",
39 Self::InvalidDke => "invalid GOST substitution table",
40 Self::InvalidOutputSize => "invalid hash output size",
41 Self::InputTooLong => "input exceeds the supported bound",
42 })
43 }
44}
45
46impl core::error::Error for Error {}