-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patherror.rs
34 lines (31 loc) · 1.06 KB
/
error.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//! Error Module
use thiserror::Error;
use zk_kit_lean_imt::lean_imt::LeanIMTError;
#[derive(Error, Debug, PartialEq, Eq)]
pub enum SemaphoreError {
#[error("Member already removed")]
AlreadyRemovedMember,
#[error("Member value is empty")]
EmptyLeaf,
#[error("Input array of size {0} exceeds maximum allowed length of 32 bytes")]
InputSizeExceeded(usize),
#[error("LeanIMT error: {0}")]
LeanIMTError(LeanIMTError),
#[error("Message of size {0} exceeds maximum allowed length of 32 bytes")]
MessageSizeExceeded(usize),
#[error("Public key validation failed: point is not on curve")]
PublicKeyNotOnCurve,
#[error("Member has been removed")]
RemovedMember,
#[error("Signature point R is not on curve")]
SignaturePointNotOnCurve,
#[error("Signature verification failed")]
SignatureVerificationFailed,
#[error("Serialization error: {0}")]
SerializationError(String),
}
impl From<LeanIMTError> for SemaphoreError {
fn from(error: LeanIMTError) -> Self {
SemaphoreError::LeanIMTError(error)
}
}