use ink_revive_types::evm::CallTrace;
use std::fmt;
#[derive(Debug, thiserror::Error)]
pub enum Error<DispatchError: fmt::Debug + fmt::Display> {
#[error("Contract not found: {0}")]
ContractNotFound(String),
#[error("Instantiate dry-run error: {0}")]
InstantiateDryRun(DryRunError<DispatchError>),
#[error("Instantiate extrinsic error: {0} {1:?}")]
InstantiateExtrinsic(DispatchError, Option<CallTrace>),
#[error("Upload dry-run error: {0}")]
UploadDryRun(DispatchError),
#[error("Upload extrinsic error: {0}")]
UploadExtrinsic(DispatchError, Option<CallTrace>),
#[error("Call dry-run error: {0}")]
CallDryRun(DryRunError<DispatchError>),
#[error("Call extrinsic error: {0}")]
CallExtrinsic(DispatchError, Option<CallTrace>),
#[error("Remove code extrinsic error: {0}")]
RemoveCodeExtrinsic(DispatchError, Option<CallTrace>),
#[error("Fetching account Balance error: {0}")]
Balance(String),
#[error("Decoding failed: {0}")]
Decoding(String),
#[error("Other error: {0}")]
Other(String),
}
#[derive(Debug)]
pub struct DryRunError<DispatchError: fmt::Display + fmt::Debug> {
pub error: DispatchError,
}
impl<DispatchError> fmt::Display for DryRunError<DispatchError>
where
DispatchError: fmt::Display + fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
<Self as fmt::Debug>::fmt(self, f)
}
}