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 48 49 50 51
//! Error type for the node library.
use std::path::PathBuf;
use thiserror::Error;
/// Errors generated by the node library.
#[derive(Debug, Error)]
pub enum Error {
/// Error generated if we could not determine a cache directory.
#[error("could not determine cache directory")]
NoCache,
/// Error generated attempting acquire a lock on a file that is already locked.
#[error("file {0} is already locked")]
FileLocked(PathBuf),
/// Error generated by the std::io module.
#[error(transparent)]
Io(#[from] std::io::Error),
/// Error generated converting from a slice.
#[error(transparent)]
TryFromSlice(#[from] std::array::TryFromSliceError),
/// Error generated by the core library.
#[error(transparent)]
Core(#[from] sos_sdk::Error),
/// Error generate by the signature library.
#[error(transparent)]
Signature(#[from] web3_signature::SignatureError),
/// Error generate by the ECDSA library.
#[error(transparent)]
Ecdsa(#[from] sos_sdk::k256::ecdsa::Error),
/// Error generate by the elliptic curve library.
#[error(transparent)]
Elliptic(#[from] sos_sdk::k256::elliptic_curve::Error),
/// Error generated by the address library.
#[error(transparent)]
Address(#[from] web3_address::Error),
/// Error generated by the JSON library.
#[error(transparent)]
Json(#[from] serde_json::Error),
/// Error generated by the Base58 library.
#[error(transparent)]
Base58(#[from] bs58::encode::Error),
}