pub struct ExecutionError(/* private fields */);
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.

Implementations§

source§

impl ExecutionError

source

pub fn new(code: u16, msg: &str) -> Self

Creates an instance with specified code and message.

If the custom error code space is violated, an error with code 32768 is returned.

source

pub fn code(&self) -> u16

Return the underlying error code

source

pub fn unwrap_error() -> Self

Creates a specific type of error, meaning that value unwrapping failed.

source

pub fn non_payable() -> Self

source

pub fn can_not_transfer_to_contract() -> Self

source

pub fn reentrant_call() -> Self

source

pub fn contract_already_installed() -> Self

source

pub fn unknown_constructor() -> Self

source

pub fn native_token_transfer_error() -> Self

source

pub fn addition_overflow() -> Self

source

pub fn subtraction_overflow() -> Self

source

pub fn index_out_of_bounds() -> Self

source

pub fn zero_address() -> Self

source

pub fn address_creation_failed() -> Self

Trait Implementations§

source§

impl Clone for ExecutionError

source§

fn clone(&self) -> ExecutionError

Returns a copy 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<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: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.