#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("parse url: {0}")]
ParseUrl(#[from] url::ParseError),
#[error("parse cluster: {0}")]
ParseCluster(&'static str),
#[error("merge transaction: {0}")]
MergeTransaction(&'static str),
#[error("add transaction: {0}")]
AddTransaction(&'static str),
#[error("compile message: {0}")]
CompileMessage(#[from] solana_sdk::message::CompileError),
#[cfg(feature = "solana-client")]
#[error("client: {0}")]
Client(#[from] Box<solana_client::client_error::ClientError>),
#[error("signer: {0}")]
Signer(#[from] solana_sdk::signer::SignerError),
#[error("custom: {0}")]
Custom(String),
}
impl<T> From<(T, Error)> for Error {
fn from(value: (T, crate::Error)) -> Self {
value.1
}
}
impl Error {
pub fn custom(msg: impl ToString) -> Self {
Self::Custom(msg.to_string())
}
}