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,
    },
    ConversionOverflow {
        source: ConversionOverflowError,
    },
}
Expand description

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

Fields of VerificationErr

source: VerificationError
RecoverPubkeyErr

Fields of RecoverPubkeyErr

source: RecoverPubkeyError
GenericErr

Whenever there is no specific error type available

Fields of GenericErr

msg: String
InvalidBase64

Fields of InvalidBase64

msg: String
InvalidDataSize

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.

Fields of InvalidUtf8

msg: String
NotFound

Fields of NotFound

kind: String
ParseErr

Fields of ParseErr

target_type: String

the target type that was attempted

msg: String
SerializeErr

Fields of SerializeErr

source_type: String

the source type that was attempted

msg: String
Overflow

Fields of Overflow

source: OverflowError
DivideByZero

Fields of DivideByZero

source: DivideByZeroError
ConversionOverflow

Fields of ConversionOverflow

source: ConversionOverflowError

Implementations

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.