threshold_crypto/
error.rs1use failure::Fail;
4
5#[derive(Clone, Eq, PartialEq, Debug, Fail)]
7pub enum Error {
8 #[fail(display = "Not enough signature shares")]
10 NotEnoughShares,
11 #[fail(display = "Signature shares contain a duplicated index")]
13 DuplicateEntry,
14 #[fail(display = "The degree is too high for the coefficients to be indexed by usize.")]
16 DegreeTooHigh,
17}
18
19pub type Result<T> = ::std::result::Result<T, Error>;
21
22#[cfg(test)]
23mod tests {
24 use super::Error;
25
26 fn is_send_and_sync<T: Send + Sync>(_: T) {}
28
29 #[test]
30 fn errors_are_send_and_sync() {
31 is_send_and_sync(Error::NotEnoughShares);
32 }
33}
34
35#[derive(Clone, Eq, PartialEq, Debug, Fail)]
37pub enum FromBytesError {
38 #[fail(display = "Invalid representation.")]
40 Invalid,
41}
42
43pub type FromBytesResult<T> = ::std::result::Result<T, FromBytesError>;