pub enum Cis2Error<R> {
    InvalidTokenId,
    InsufficientFunds,
    Unauthorized,
    Custom(R),
}
Expand description

The different errors the contract can produce.

Variants§

§

InvalidTokenId

Invalid token id (Error code: -42000001).

§

InsufficientFunds

The balance of the token owner is insufficient for the transfer (Error code: -42000002).

§

Unauthorized

Sender is unauthorized to call this function (Error code: -42000003).

§

Custom(R)

Custom error

Trait Implementations§

source§

impl<R: Debug> Debug for Cis2Error<R>

source§

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

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

impl<R> Deserial for Cis2Error<R>
where R: Deserial,

source§

fn deserial<__R: Read>(________________source: &mut __R) -> ParseResult<Self>

Attempt to read a structure from a given source, failing if an error occurs during deserialization or reading.
source§

impl<T, X> From<CallContractError<T>> for Cis2Error<X>
where X: From<CallContractError<T>>,

source§

fn from(err: CallContractError<T>) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<X> From<CheckAccountSignatureError> for Cis2Error<X>

source§

fn from(err: CheckAccountSignatureError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<R: Into<Reject> + Serial> From<Cis2Error<R>> for Reject

Convert Cis2Error into a reject with error code:

  • InvalidTokenId: -42000001
  • InsufficientFunds: -42000002
  • Unauthorized: -42000003
  • Custom: The error code of R.

Also serializes the Cis2Error and adds it as the return value.

source§

fn from(err: Cis2Error<R>) -> Self

Converts to this type from the input type.
source§

impl<X> From<LogError> for Cis2Error<X>
where X: From<LogError>,

source§

fn from(err: LogError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<X> From<NewContractNameError> for Cis2Error<X>
where X: From<NewContractNameError>,

source§

fn from(err: NewContractNameError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<X> From<NewReceiveNameError> for Cis2Error<X>
where X: From<NewReceiveNameError>,

source§

fn from(err: NewReceiveNameError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<X> From<ParseError> for Cis2Error<X>
where X: From<ParseError>,

source§

fn from(err: ParseError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<X> From<QueryAccountBalanceError> for Cis2Error<X>

source§

fn from(err: QueryAccountBalanceError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<X> From<QueryAccountPublicKeysError> for Cis2Error<X>

source§

fn from(err: QueryAccountPublicKeysError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<X> From<QueryContractBalanceError> for Cis2Error<X>

source§

fn from(err: QueryContractBalanceError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<X> From<TransferError> for Cis2Error<X>
where X: From<TransferError>,

source§

fn from(err: TransferError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<X> From<UpgradeError> for Cis2Error<X>
where X: From<UpgradeError>,

source§

fn from(err: UpgradeError) -> Self

Converts the error by wrapping it in Self::Custom.

source§

impl<R: PartialEq> PartialEq for Cis2Error<R>

source§

fn eq(&self, other: &Cis2Error<R>) -> 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.
source§

impl<R> SchemaType for Cis2Error<R>
where R: SchemaType,

source§

fn get_type() -> Type

source§

impl<R> Serial for Cis2Error<R>
where R: Serial,

source§

fn serial<W: Write>(&self, out: &mut W) -> Result<(), W::Err>

Attempt to write the structure into the provided writer, failing if only part of the structure could be written. Read more
source§

impl<R: Eq> Eq for Cis2Error<R>

source§

impl<R> StructuralPartialEq for Cis2Error<R>

Auto Trait Implementations§

§

impl<R> RefUnwindSafe for Cis2Error<R>
where R: RefUnwindSafe,

§

impl<R> Send for Cis2Error<R>
where R: Send,

§

impl<R> Sync for Cis2Error<R>
where R: Sync,

§

impl<R> Unpin for Cis2Error<R>
where R: Unpin,

§

impl<R> UnwindSafe for Cis2Error<R>
where R: UnwindSafe,

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> Deletable for T
where T: Serialize,

source§

fn delete(self)

Delete all items that this type owns in the state.
source§

impl<D, S> DeserialWithState<S> for D
where D: Deserial, S: HasStateApi,

source§

fn deserial_with_state<R>(_state: &S, source: &mut R) -> Result<D, ParseError>
where R: Read,

Attempt to read a structure from a given source and state, failing if an error occurs during deserialization or reading.
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, 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.
§

impl<A> Serialize for A
where A: Deserial + Serial,