| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364 |
- pub type Result<T> = std::result::Result<T, Error>;
- #[derive(Clone, Debug, thiserror::Error)]
- pub enum Error {
- #[error("io error: `{0:?}`")]
- Io(std::io::ErrorKind),
- #[error("Infallible Error: `{0}`")]
- InfallibleError(String),
- #[cfg(feature = "util")]
- #[error("VarInt was encoded in a non-minimal way")]
- NonMinimalVarInt,
- #[cfg(feature = "util")]
- #[error("parse failed: `{0}`")]
- ParseFailed(&'static str),
- #[error("decode failed: `{0}`")]
- DecodeError(&'static str),
- #[error("encode failed: `{0}`")]
- EncodeError(&'static str),
- #[error(transparent)]
- ParseIntError(#[from] std::num::ParseIntError),
- #[error(transparent)]
- ParseFloatError(#[from] std::num::ParseFloatError),
- #[cfg(feature = "util")]
- #[error(transparent)]
- ParseBigIntError(#[from] num_bigint::ParseBigIntError),
- #[cfg(any(feature = "rpc", feature = "node", feature = "util"))]
- #[error("Url parse error `{0}`")]
- UrlParseError(String),
- #[cfg(any(feature = "rpc"))]
- #[error("Socks error `{0}`")]
- SocksError(String),
- #[error("No url found")]
- NoUrlFound,
- #[error("No socks5 url found")]
- NoSocks5UrlFound,
- #[error(transparent)]
- AddrParseError(#[from] std::net::AddrParseError),
- #[error(transparent)]
- Utf8Error(#[from] std::string::FromUtf8Error),
- #[error(transparent)]
- StrUtf8Error(#[from] std::str::Utf8Error),
- #[error("TryFrom error")]
- TryFromError,
- #[cfg(feature = "util")]
- #[error(transparent)]
- TryFromBigIntError(#[from] num_bigint::TryFromBigIntError<num_bigint::BigUint>),
- #[cfg(feature = "util")]
- #[error("Json serialization error: `{0}`")]
- SerdeJsonError(String),
- #[cfg(feature = "util")]
- #[error(transparent)]
- TomlDeserializeError(#[from] toml::de::Error),
- #[cfg(feature = "util")]
- #[error("Bincode serialization error: `{0}`")]
- BincodeError(String),
- #[error("Bad operation type byte")]
- BadOperationType,
- #[error("Invalid param name")]
- InvalidParamName,
- #[error("Invalid param type")]
- InvalidParamType,
- #[error("Missing params")]
- MissingParams,
- #[cfg(feature = "crypto")]
- #[error("Plonk error: `{0}`")]
- PlonkError(String),
- #[cfg(feature = "crypto")]
- #[error("Unable to decrypt mint note")]
- NoteDecryptionFailed,
- #[cfg(feature = "node")]
- #[error(transparent)]
- VerifyFailed(#[from] crate::node::state::VerifyFailed),
- #[error("Services Error: `{0}`")]
- ServicesError(&'static str),
- #[error("Client failed: `{0}`")]
- ClientFailed(String),
- #[error("Cashier failed: `{0}`")]
- CashierError(String),
- #[error("ZmqError: `{0}`")]
- ZmqError(String),
- #[cfg(feature = "blockchain")]
- #[error("Rocksdb error: `{0}`")]
- RocksdbError(String),
- #[cfg(feature = "node")]
- #[error("sqlx error: `{0}`")]
- SqlxError(String),
- #[cfg(feature = "node")]
- #[error("SlabsStore Error: `{0}`")]
- SlabsStore(String),
- #[error("JsonRpc Error: `{0}`")]
- JsonRpcError(String),
- #[error("Not supported network")]
- NotSupportedNetwork,
- #[error("Not supported token")]
- NotSupportedToken,
- #[error("Could not parse token parameter")]
- TokenParseError,
- #[cfg(feature = "async-net")]
- #[error("Async_Native_TLS error: `{0}`")]
- AsyncNativeTlsError(String),
- #[cfg(feature = "websockets")]
- #[error("TungsteniteError: `{0}`")]
- TungsteniteError(String),
- #[error("Connection failed")]
- ConnectFailed,
- #[error("Connection timed out")]
- ConnectTimeout,
- #[error("Channel stopped")]
- ChannelStopped,
- #[error("Channel timed out")]
- ChannelTimeout,
- #[error("Service stopped")]
- ServiceStopped,
- #[error("Operation failed")]
- OperationFailed,
- #[error("Malformed packet")]
- MalformedPacket,
- #[error("No config file detected. Please create one.")]
- ConfigNotFound,
- #[cfg(feature = "util")]
- #[error("No keypair file detected.")]
- KeypairPathNotFound,
- #[error("No cashier public keys detected.")]
- CashierKeysNotFound,
- #[error("SetLoggerError")]
- SetLoggerError,
- #[cfg(feature = "async-runtime")]
- #[error("Async_channel sender error")]
- AsyncChannelSenderError,
- #[cfg(feature = "async-runtime")]
- #[error(transparent)]
- AsyncChannelReceiverError(#[from] async_channel::RecvError),
- #[cfg(feature = "crypto")]
- #[error("Error converting bytes to PublicKey")]
- PublicKeyFromBytes,
- #[cfg(feature = "crypto")]
- #[error("Error converting bytes to SecretKey")]
- SecretKeyFromBytes,
- #[cfg(feature = "crypto")]
- #[error("Invalid Address")]
- InvalidAddress,
- #[error("Invalid bincode: {0}")]
- ZkasDecoderError(&'static str),
- #[cfg(feature = "wasm-runtime")]
- #[error("wasm export error: {0}")]
- WasmerExportError(String),
- #[cfg(feature = "wasm-runtime")]
- #[error("wasm runtime error: {0}")]
- WasmerRuntimeError(String),
- #[cfg(feature = "wasm-runtime")]
- #[error("wasm instantiation error: {0}")]
- WasmerInstantiationError(String),
- #[cfg(feature = "wasm-runtime")]
- #[error("wasm compile error: {0}")]
- WasmerCompileError(String),
- #[cfg(feature = "wasm-runtime")]
- #[error("wasm runtime out of memory")]
- WasmerOomError,
- #[cfg(any(feature = "blockchain2", feature = "raft"))]
- #[error(transparent)]
- SledError(#[from] sled::Error),
- #[error("Unsupported network transport")]
- UnsupportedTransport,
- }
- #[cfg(feature = "node")]
- impl From<zeromq::ZmqError> for Error {
- fn from(err: zeromq::ZmqError) -> Error {
- Error::ZmqError(err.to_string())
- }
- }
- #[cfg(feature = "blockchain")]
- impl From<rocksdb::Error> for Error {
- fn from(err: rocksdb::Error) -> Error {
- Error::RocksdbError(err.to_string())
- }
- }
- #[cfg(feature = "node")]
- impl From<sqlx::error::Error> for Error {
- fn from(err: sqlx::error::Error) -> Error {
- Error::SqlxError(err.to_string())
- }
- }
- #[cfg(feature = "util")]
- impl From<serde_json::Error> for Error {
- fn from(err: serde_json::Error) -> Error {
- Error::SerdeJsonError(err.to_string())
- }
- }
- impl From<std::io::Error> for Error {
- fn from(err: std::io::Error) -> Error {
- Error::Io(err.kind())
- }
- }
- #[cfg(feature = "async-runtime")]
- impl<T> From<async_channel::SendError<T>> for Error {
- fn from(_err: async_channel::SendError<T>) -> Error {
- Error::AsyncChannelSenderError
- }
- }
- #[cfg(feature = "async-net")]
- impl From<async_native_tls::Error> for Error {
- fn from(err: async_native_tls::Error) -> Error {
- Error::AsyncNativeTlsError(err.to_string())
- }
- }
- #[cfg(any(feature = "rpc", feature = "util"))]
- impl From<url::ParseError> for Error {
- fn from(err: url::ParseError) -> Error {
- Error::UrlParseError(err.to_string())
- }
- }
- #[cfg(feature = "node")]
- impl From<crate::node::client::ClientFailed> for Error {
- fn from(err: crate::node::client::ClientFailed) -> Error {
- Error::ClientFailed(err.to_string())
- }
- }
- impl From<log::SetLoggerError> for Error {
- fn from(_err: log::SetLoggerError) -> Error {
- Error::SetLoggerError
- }
- }
- #[cfg(feature = "websockets")]
- impl From<tungstenite::Error> for Error {
- fn from(err: tungstenite::Error) -> Error {
- Error::TungsteniteError(err.to_string())
- }
- }
- #[cfg(feature = "util")]
- impl From<Box<bincode::ErrorKind>> for Error {
- fn from(err: Box<bincode::ErrorKind>) -> Error {
- Error::BincodeError(err.to_string())
- }
- }
- #[cfg(feature = "rpc")]
- impl From<fast_socks5::SocksError> for Error {
- fn from(err: fast_socks5::SocksError) -> Error {
- Error::SocksError(err.to_string())
- }
- }
- impl From<std::convert::Infallible> for Error {
- fn from(err: std::convert::Infallible) -> Error {
- Error::InfallibleError(err.to_string())
- }
- }
- impl From<()> for Error {
- fn from(_err: ()) -> Error {
- Error::InfallibleError("Infallible".into())
- }
- }
- #[cfg(feature = "crypto")]
- impl From<halo2_proofs::plonk::Error> for Error {
- fn from(err: halo2_proofs::plonk::Error) -> Error {
- Error::PlonkError(err.to_string())
- }
- }
- #[cfg(feature = "wasm-runtime")]
- impl From<wasmer::CompileError> for Error {
- fn from(err: wasmer::CompileError) -> Error {
- Error::WasmerCompileError(err.to_string())
- }
- }
- #[cfg(feature = "wasm-runtime")]
- impl From<wasmer::ExportError> for Error {
- fn from(err: wasmer::ExportError) -> Error {
- Error::WasmerExportError(err.to_string())
- }
- }
- #[cfg(feature = "wasm-runtime")]
- impl From<wasmer::RuntimeError> for Error {
- fn from(err: wasmer::RuntimeError) -> Error {
- Error::WasmerRuntimeError(err.to_string())
- }
- }
- #[cfg(feature = "wasm-runtime")]
- impl From<wasmer::InstantiationError> for Error {
- fn from(err: wasmer::InstantiationError) -> Error {
- Error::WasmerInstantiationError(err.to_string())
- }
- }
|