ExecutionError

Enum ExecutionError 

Source
#[repr(u16)]
pub enum ExecutionError {
Show 40 variants UnwrapError = 1, UnexpectedError = 2, AdditionOverflow = 100, SubtractionOverflow = 101, NonPayable = 102, TransferToContract = 103, ReentrantCall = 104, CannotOverrideKeys = 105, UnknownConstructor = 106, NativeTransferError = 107, IndexOutOfBounds = 108, ZeroAddress = 109, AddressCreationFailed = 110, EarlyEndOfStream = 111, Formatting = 112, LeftOverBytes = 113, OutOfMemory = 114, NotRepresentable = 115, ExceededRecursionDepth = 116, KeyNotFound = 117, CouldNotDeserializeSignature = 118, TypeMismatch = 119, CouldNotSignMessage = 120, EmptyDictionaryName = 121, MissingArg = 122, MissingAddress = 123, OutOfGas = 124, MainPurseError = 125, ConversionError = 126, ContractDeploymentError = 127, CannotExtractCallerInfo = 128, ContractNotInstalled = 129, UpgradingWithoutPreviousVersion = 130, UpgradingNotAContract = 131, SchemaMismatch = 132, CannotDisablePreviousVersion = 133, CannotUpgradeWithoutUpgrade = 134, MaxUserError = 64_535, UserErrorTooHigh = 64_536, User(UserError),
}
Expand description

An error that can occur during smart contract execution

It is represented by an error code and a human-readable message.

Errors codes 0..32767 are available for the user to define custom error in smart contracts. 32768 code is a special code representing a violation of the custom error code space.

The rest of codes 32769..u16::MAX, are used internally by the framework.

Variants§

§

UnwrapError = 1

Unwrap error.

§

UnexpectedError = 2

Something unexpected happened.

§

AdditionOverflow = 100

Addition overflow

§

SubtractionOverflow = 101

Subtraction overflow

§

NonPayable = 102

Method does not accept deposit

§

TransferToContract = 103

Can’t transfer tokens to contract.

§

ReentrantCall = 104

Reentrant call detected

§

CannotOverrideKeys = 105

Contract already installed

§

UnknownConstructor = 106

Unknown constructor

§

NativeTransferError = 107

Native transfer error

§

IndexOutOfBounds = 108

Index out of bounds

§

ZeroAddress = 109

Tried to construct a zero address.

§

AddressCreationFailed = 110

Address creation failed

§

EarlyEndOfStream = 111

Early end of stream - deserialization error

§

Formatting = 112

Formatting error - deserialization error

§

LeftOverBytes = 113

Left over bytes - deserialization error

§

OutOfMemory = 114

Out of memory

§

NotRepresentable = 115

Not representable

§

ExceededRecursionDepth = 116

Exceeded recursion depth

§

KeyNotFound = 117

Key not found

§

CouldNotDeserializeSignature = 118

Could not deserialize signature

§

TypeMismatch = 119

Type mismatch

§

CouldNotSignMessage = 120

Could not sign message

§

EmptyDictionaryName = 121

Empty dictionary name

§

MissingArg = 122

Calling a contract with missing entrypoint arguments.

§

MissingAddress = 123

Reading the address from the storage failed.

§

OutOfGas = 124

Out of gas error

§

MainPurseError = 125

MainPurse error

§

ConversionError = 126

Conversion error

§

ContractDeploymentError = 127

Couldn’t deploy the contract

§

CannotExtractCallerInfo = 128

Couldn’t extract caller info

§

ContractNotInstalled = 129

Upgrading a contract that is not installed.

§

UpgradingWithoutPreviousVersion = 130

Upgrading a contract without previous version

§

UpgradingNotAContract = 131

Upgrading not a contract

§

SchemaMismatch = 132

Upgrading a contract with a schema that does not match the previous version.

§

CannotDisablePreviousVersion = 133

Cannot disable a previous version of a contract.

§

CannotUpgradeWithoutUpgrade = 134

Cannot upgrade a contract without an upgrade function.

§

MaxUserError = 64_535

Maximum code for user errors

§

UserErrorTooHigh = 64_536

User error too high. The code should be in range 0..32767.

§

User(UserError)

User error

Implementations§

Source§

impl ExecutionError

Source

pub fn code(&self) -> u16

Returns the error code.

Trait Implementations§

Source§

impl Clone for ExecutionError

Source§

fn clone(&self) -> ExecutionError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExecutionError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<AddressError> for ExecutionError

Source§

fn from(error: AddressError) -> Self

Converts to this type from the input type.
Source§

impl From<ArithmeticsError> for ExecutionError

Source§

fn from(error: ArithmeticsError) -> Self

Converts to this type from the input type.
Source§

impl From<CollectionError> for ExecutionError

Source§

fn from(error: CollectionError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ExecutionError

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ExecutionError> for OdraError

Source§

fn from(error: ExecutionError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ExecutionError

Source§

fn eq(&self, other: &ExecutionError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ExecutionError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more