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

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.

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

Converts self into a target type. Read more

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Performs the conversion.

Performs the conversion.

Pipes a value into a function that cannot ordinarily be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a dereference into a function that cannot normally be called in suffix position. Read more

Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more

Pipes a reference into a function that cannot ordinarily be called in suffix position. Read more

Pipes a mutable reference into a function that cannot ordinarily be called in suffix position. Read more

Should always be Self

Provides immutable access for inspection. Read more

Calls tap in debug builds, and does nothing in release builds.

Provides mutable access for modification. Read more

Calls tap_mut in debug builds, and does nothing in release builds.

Provides immutable access to the reference for inspection.

Calls tap_ref in debug builds, and does nothing in release builds.

Provides mutable access to the reference for modification.

Calls tap_ref_mut in debug builds, and does nothing in release builds.

Provides immutable access to the borrow for inspection. Read more

Calls tap_borrow in debug builds, and does nothing in release builds.

Provides mutable access to the borrow for modification.

Calls tap_borrow_mut in debug builds, and does nothing in release builds. Read more

Immutably dereferences self for inspection.

Calls tap_deref in debug builds, and does nothing in release builds.

Mutably dereferences self for modification.

Calls tap_deref_mut in debug builds, and does nothing in release builds. Read more

Converts the given value to a String. Read more

Attempts to convert self into a target type. 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.