snarkvm_parameters/errors/
parameter.rs1use std::fmt::Debug;
17
18#[derive(Debug, Error)]
19pub enum ParameterError {
20 #[error("expected checksum of {}, found checksum of {}", _0, _1)]
21 ChecksumMismatch(String, String),
22
23 #[error("{}: {}", _0, _1)]
24 Crate(&'static str, String),
25
26 #[error("{}", _0)]
27 Message(String),
28
29 #[error("Remote fetch is disabled, enable compiler flag for feature")]
30 RemoteFetchDisabled,
31
32 #[error("Expected size of {}, found size of {}", _0, _1)]
33 SizeMismatch(usize, usize),
34
35 #[error("{}", _0)]
36 Wasm(String),
37}
38
39#[cfg(not(feature = "wasm"))]
40impl From<curl::Error> for ParameterError {
41 fn from(error: curl::Error) -> Self {
42 ParameterError::Crate("curl::error", format!("{error:?}"))
43 }
44}
45
46impl From<std::io::Error> for ParameterError {
47 fn from(error: std::io::Error) -> Self {
48 ParameterError::Crate("std::io", format!("{error:?}"))
49 }
50}
51
52impl From<std::path::StripPrefixError> for ParameterError {
53 fn from(error: std::path::StripPrefixError) -> Self {
54 ParameterError::Crate("std::path", format!("{error:?}"))
55 }
56}
57
58impl From<ParameterError> for std::io::Error {
59 fn from(error: ParameterError) -> Self {
60 std::io::Error::new(std::io::ErrorKind::Other, format!("{error:?}"))
61 }
62}