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 #[error("Filesystem access is disabled, enable compiler flag for feature")]
39 FilesystemDisabled,
40}
41
42#[cfg(all(not(feature = "wasm"), not(target_env = "sgx")))]
43impl From<curl::Error> for ParameterError {
44 fn from(error: curl::Error) -> Self {
45 ParameterError::Crate("curl::error", format!("{error:?}"))
46 }
47}
48
49impl From<std::io::Error> for ParameterError {
50 fn from(error: std::io::Error) -> Self {
51 ParameterError::Crate("std::io", format!("{error:?}"))
52 }
53}
54
55impl From<std::path::StripPrefixError> for ParameterError {
56 fn from(error: std::path::StripPrefixError) -> Self {
57 ParameterError::Crate("std::path", format!("{error:?}"))
58 }
59}
60
61impl From<ParameterError> for std::io::Error {
62 fn from(error: ParameterError) -> Self {
63 std::io::Error::other(format!("{error:?}"))
64 }
65}