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
35
36
37
38
39
40
41
42
43
44
45
46
47
use ark_std::fmt;
use ark_std::string::String;
use core::fmt::Formatter;
#[derive(fmt::Debug)]
pub enum Error {
Reject(Option<String>),
IOError,
SerializationError,
RNGError,
OtherError(String),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
if let Self::OtherError(s) = self {
f.write_str(s)
} else {
f.write_fmt(format_args!("{:?}", self))
}
}
}
impl ark_std::error::Error for Error {}
impl From<ark_std::io::Error> for Error {
fn from(_: ark_std::io::Error) -> Self {
Self::IOError
}
}
impl From<ark_serialize::SerializationError> for Error {
fn from(_: ark_serialize::SerializationError) -> Self {
Self::SerializationError
}
}
impl From<ark_std::rand::Error> for Error {
fn from(_: ark_std::rand::Error) -> Self {
Self::RNGError
}
}