|
1 | 1 | /// Errors that can occur when using the SSKR library.
|
2 |
| -#[derive(Debug, PartialEq, Eq, Clone)] |
| 2 | +#[derive(Debug)] |
3 | 3 | pub enum Error {
|
4 | 4 | /// When combining shares, the provided shares contained a duplicate member index.
|
5 | 5 | DuplicateMemberIndex,
|
@@ -46,22 +46,23 @@ pub enum Error {
|
46 | 46 |
|
47 | 47 | impl std::fmt::Display for Error {
|
48 | 48 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
49 |
| - match *self { |
50 |
| - Error::DuplicateMemberIndex => write!(f, "Duplicate member index"), |
51 |
| - Error::GroupCountInvalid => write!(f, "Invalid group count"), |
52 |
| - Error::GroupThresholdInvalid => write!(f, "Invalid group threshold"), |
53 |
| - Error::MemberCountInvalid => write!(f, "Not enough shares"), |
54 |
| - Error::MemberThresholdInvalid => write!(f, "Invalid member threshold"), |
55 |
| - Error::NotEnoughGroups => write!(f, "Not enough groups"), |
56 |
| - Error::SecretLengthNotEven => write!(f, "Secret is not of even length"), |
57 |
| - Error::SecretTooLong => write!(f, "Secret is too long"), |
58 |
| - Error::SecretTooShort => write!(f, "Secret is too short"), |
59 |
| - Error::ShareLengthInvalid => write!(f, "Not enough serialized bytes"), |
60 |
| - Error::ShareReservedBitsInvalid => write!(f, "Invalid reserved bits"), |
61 |
| - Error::SharesEmpty => write!(f, "Empty share set"), |
62 |
| - Error::ShareSetInvalid => write!(f, "Invalid share set"), |
63 |
| - Error::ShamirError(ref e) => write!(f, "{}", e), |
64 |
| - } |
| 49 | + let s = match *self { |
| 50 | + Error::DuplicateMemberIndex => "Duplicate member index".to_string(), |
| 51 | + Error::GroupCountInvalid => "Invalid group count".to_string(), |
| 52 | + Error::GroupThresholdInvalid => "Invalid group threshold".to_string(), |
| 53 | + Error::MemberCountInvalid => "Not enough shares".to_string(), |
| 54 | + Error::MemberThresholdInvalid => "Invalid member threshold".to_string(), |
| 55 | + Error::NotEnoughGroups => "Not enough groups".to_string(), |
| 56 | + Error::SecretLengthNotEven => "Secret is not of even length".to_string(), |
| 57 | + Error::SecretTooLong => "Secret is too long".to_string(), |
| 58 | + Error::SecretTooShort => "Secret is too short".to_string(), |
| 59 | + Error::ShareLengthInvalid => "Not enough serialized bytes".to_string(), |
| 60 | + Error::ShareReservedBitsInvalid => "Invalid reserved bits".to_string(), |
| 61 | + Error::SharesEmpty => "Empty share set".to_string(), |
| 62 | + Error::ShareSetInvalid => "Invalid share set".to_string(), |
| 63 | + Error::ShamirError(ref e) => format!("{}", e), |
| 64 | + }; |
| 65 | + f.write_str(&s) |
65 | 66 | }
|
66 | 67 | }
|
67 | 68 |
|
|
0 commit comments