use codec::{Decode, DecodeWithMemTracking, Encode};
use pezframe_support::PalletError;
use scale_info::TypeInfo;
use xcm::latest::Error as XcmError;
#[derive(
Copy, Clone, Encode, Decode, DecodeWithMemTracking, Eq, PartialEq, Debug, TypeInfo, PalletError,
)]
pub enum ExecutionError {
#[codec(index = 0)]
Overflow,
#[codec(index = 1)]
Unimplemented,
#[codec(index = 2)]
UntrustedReserveLocation,
#[codec(index = 3)]
UntrustedTeleportLocation,
#[codec(index = 4)]
LocationFull,
#[codec(index = 5)]
LocationNotInvertible,
#[codec(index = 6)]
BadOrigin,
#[codec(index = 7)]
InvalidLocation,
#[codec(index = 8)]
AssetNotFound,
#[codec(index = 9)]
FailedToTransactAsset,
#[codec(index = 10)]
NotWithdrawable,
#[codec(index = 11)]
LocationCannotHold,
#[codec(index = 12)]
ExceedsMaxMessageSize,
#[codec(index = 13)]
DestinationUnsupported,
#[codec(index = 14)]
Transport,
#[codec(index = 15)]
Unroutable,
#[codec(index = 16)]
UnknownClaim,
#[codec(index = 17)]
FailedToDecode,
#[codec(index = 18)]
MaxWeightInvalid,
#[codec(index = 19)]
NotHoldingFees,
#[codec(index = 20)]
TooExpensive,
#[codec(index = 21)]
Trap,
#[codec(index = 22)]
ExpectationFalse,
#[codec(index = 23)]
PalletNotFound,
#[codec(index = 24)]
NameMismatch,
#[codec(index = 25)]
VersionIncompatible,
#[codec(index = 26)]
HoldingWouldOverflow,
#[codec(index = 27)]
ExportError,
#[codec(index = 28)]
ReanchorFailed,
#[codec(index = 29)]
NoDeal,
#[codec(index = 30)]
FeesNotMet,
#[codec(index = 31)]
LockError,
#[codec(index = 32)]
NoPermission,
#[codec(index = 33)]
Unanchored,
#[codec(index = 34)]
NotDepositable,
#[codec(index = 35)]
TooManyAssets,
UnhandledXcmVersion,
WeightLimitReached,
Barrier,
WeightNotComputable,
ExceedsStackLimit,
}
impl From<XcmError> for ExecutionError {
fn from(error: XcmError) -> Self {
match error {
XcmError::Overflow => Self::Overflow,
XcmError::Unimplemented => Self::Unimplemented,
XcmError::UntrustedReserveLocation => Self::UntrustedReserveLocation,
XcmError::UntrustedTeleportLocation => Self::UntrustedTeleportLocation,
XcmError::LocationFull => Self::LocationFull,
XcmError::LocationNotInvertible => Self::LocationNotInvertible,
XcmError::BadOrigin => Self::BadOrigin,
XcmError::InvalidLocation => Self::InvalidLocation,
XcmError::AssetNotFound => Self::AssetNotFound,
XcmError::FailedToTransactAsset(_) => Self::FailedToTransactAsset,
XcmError::NotWithdrawable => Self::NotWithdrawable,
XcmError::LocationCannotHold => Self::LocationCannotHold,
XcmError::ExceedsMaxMessageSize => Self::ExceedsMaxMessageSize,
XcmError::DestinationUnsupported => Self::DestinationUnsupported,
XcmError::Transport(_) => Self::Transport,
XcmError::Unroutable => Self::Unroutable,
XcmError::UnknownClaim => Self::UnknownClaim,
XcmError::FailedToDecode => Self::FailedToDecode,
XcmError::MaxWeightInvalid => Self::MaxWeightInvalid,
XcmError::NotHoldingFees => Self::NotHoldingFees,
XcmError::TooExpensive => Self::TooExpensive,
XcmError::Trap(_) => Self::Trap,
XcmError::ExpectationFalse => Self::ExpectationFalse,
XcmError::PalletNotFound => Self::PalletNotFound,
XcmError::NameMismatch => Self::NameMismatch,
XcmError::VersionIncompatible => Self::VersionIncompatible,
XcmError::HoldingWouldOverflow => Self::HoldingWouldOverflow,
XcmError::ExportError => Self::ExportError,
XcmError::ReanchorFailed => Self::ReanchorFailed,
XcmError::NoDeal => Self::NoDeal,
XcmError::FeesNotMet => Self::FeesNotMet,
XcmError::LockError => Self::LockError,
XcmError::NoPermission => Self::NoPermission,
XcmError::Unanchored => Self::Unanchored,
XcmError::NotDepositable => Self::NotDepositable,
XcmError::TooManyAssets => Self::TooManyAssets,
XcmError::UnhandledXcmVersion => Self::UnhandledXcmVersion,
XcmError::WeightLimitReached(_) => Self::WeightLimitReached,
XcmError::Barrier => Self::Barrier,
XcmError::WeightNotComputable => Self::WeightNotComputable,
XcmError::ExceedsStackLimit => Self::ExceedsStackLimit,
}
}
}