Enum cosmwasm_std::StdError[][src]

pub enum StdError {
    VerificationErr {
        source: VerificationError,
    },
    RecoverPubkeyErr {
        source: RecoverPubkeyError,
    },
    GenericErr {
        msg: String,
    },
    InvalidBase64 {
        msg: String,
    },
    InvalidDataSize {
        expected: u64,
        actual: u64,
    },
    InvalidUtf8 {
        msg: String,
    },
    NotFound {
        kind: String,
    },
    ParseErr {
        target_type: String,
        msg: String,
    },
    SerializeErr {
        source_type: String,
        msg: String,
    },
    Overflow {
        source: OverflowError,
    },
    DivideByZero {
        source: DivideByZeroError,
    },
}

Structured error type for init, execute and query.

This can be serialized and passed over the Wasm/VM boundary, which allows us to use structured error types in e.g. integration tests. In that process backtraces are stripped off.

The prefix “Std” means “the standard error within the standard library”. This is not the only result/error type in cosmwasm-std.

When new cases are added, they should describe the problem rather than what was attempted (e.g. InvalidBase64 is preferred over Base64DecodingErr). In the long run this allows us to get rid of the duplication in “StdError::FooErr”.

Checklist for adding a new error:

  • Add enum case
  • Add creator function in std_error_helpers.rs

Variants

VerificationErr
Show fields

Fields of VerificationErr

source: VerificationError
RecoverPubkeyErr
Show fields

Fields of RecoverPubkeyErr

source: RecoverPubkeyError
GenericErr

Whenever there is no specific error type available

Show fields

Fields of GenericErr

msg: String
InvalidBase64
Show fields

Fields of InvalidBase64

msg: String
InvalidDataSize
Show fields

Fields of InvalidDataSize

expected: u64actual: u64
InvalidUtf8

Whenever UTF-8 bytes cannot be decoded into a unicode string, e.g. in String::from_utf8 or str::from_utf8.

Show fields

Fields of InvalidUtf8

msg: String
NotFound
Show fields

Fields of NotFound

kind: String
ParseErr
Show fields

Fields of ParseErr

target_type: String

the target type that was attempted

msg: String
SerializeErr
Show fields

Fields of SerializeErr

source_type: String

the source type that was attempted

msg: String
Overflow
Show fields

Fields of Overflow

source: OverflowError
DivideByZero
Show fields

Fields of DivideByZero

source: DivideByZeroError

Implementations

impl StdError[src]

pub fn verification_err(source: VerificationError) -> Self[src]

pub fn recover_pubkey_err(source: RecoverPubkeyError) -> Self[src]

pub fn generic_err<S: Into<String>>(msg: S) -> Self[src]

pub fn invalid_base64<S: ToString>(msg: S) -> Self[src]

pub fn invalid_data_size(expected: usize, actual: usize) -> Self[src]

pub fn invalid_utf8<S: ToString>(msg: S) -> Self[src]

pub fn not_found<S: Into<String>>(kind: S) -> Self[src]

pub fn parse_err<T: Into<String>, M: ToString>(target: T, msg: M) -> Self[src]

pub fn serialize_err<S: Into<String>, M: ToString>(source: S, msg: M) -> Self[src]

pub fn overflow(source: OverflowError) -> Self[src]

pub fn divide_by_zero(source: DivideByZeroError) -> Self[src]

Trait Implementations

impl Debug for StdError[src]

impl Display for StdError[src]

impl Error for StdError[src]

impl From<FromUtf8Error> for StdError[src]

impl From<OverflowError> for StdError[src]

impl From<RecoverPubkeyError> for StdError[src]

impl From<Utf8Error> for StdError[src]

impl From<VerificationError> for StdError[src]

impl PartialEq<StdError> for StdError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.