Enum cosmwasm_std::StdError
source · pub enum StdError {
Show 13 variants
VerificationErr {
source: VerificationError,
},
RecoverPubkeyErr {
source: RecoverPubkeyError,
},
GenericErr {
msg: String,
},
InvalidBase64 {
msg: String,
},
InvalidDataSize {
expected: u64,
actual: u64,
},
InvalidHex {
msg: String,
},
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
source: VerificationError
RecoverPubkeyErr
Fields
source: RecoverPubkeyError
GenericErr
Whenever there is no specific error type available
InvalidBase64
InvalidDataSize
InvalidHex
InvalidUtf8
Whenever UTF-8 bytes cannot be decoded into a unicode string, e.g. in String::from_utf8 or str::from_utf8.
NotFound
ParseErr
SerializeErr
Overflow
Fields
source: OverflowError
DivideByZero
Fields
source: DivideByZeroError
ConversionOverflow
Fields
source: ConversionOverflowError