forked from arkworks-rs/snark
-
Notifications
You must be signed in to change notification settings - Fork 17
/
error.rs
34 lines (29 loc) · 939 Bytes
/
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
use crate::darlin::pcd::error::PCDError;
use marlin::Error as MarlinError;
use poly_commit::Error as PCError;
#[derive(Debug)]
pub enum FinalDarlinError {
MarlinError(MarlinError<PCError>),
PCDError(PCDError),
Other(String),
}
impl std::fmt::Display for FinalDarlinError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
FinalDarlinError::MarlinError(err) => write!(f, "{}", err),
FinalDarlinError::PCDError(err) => write!(f, "{}", err),
FinalDarlinError::Other(err) => write!(f, "{}", err),
}
}
}
impl From<MarlinError<PCError>> for FinalDarlinError {
fn from(err: MarlinError<PCError>) -> Self {
FinalDarlinError::MarlinError(err)
}
}
impl From<PCDError> for FinalDarlinError {
fn from(err: PCDError) -> Self {
FinalDarlinError::PCDError(err)
}
}
impl std::error::Error for FinalDarlinError {}