apollo_cw_multi_test/
error.rs1use cosmwasm_std::{WasmMsg, WasmQuery};
2use thiserror::Error;
3
4#[derive(Debug, Error, PartialEq, Eq)]
5pub enum Error {
6 #[error("Empty attribute key. Value: {value}")]
7 EmptyAttributeKey { value: String },
8
9 #[error("Empty attribute value. Key: {key}")]
10 EmptyAttributeValue { key: String },
11
12 #[error("Attribute key strats with reserved prefix _: {0}")]
13 ReservedAttributeKey(String),
14
15 #[error("Event type too short: {0}")]
16 EventTypeTooShort(String),
17
18 #[error("Unsupported wasm query: {0:?}")]
19 UnsupportedWasmQuery(WasmQuery),
20
21 #[error("Unsupported wasm message: {0:?}")]
22 UnsupportedWasmMsg(WasmMsg),
23
24 #[error("Unregistered code id: {0}")]
25 UnregisteredCodeId(usize),
26}
27
28impl Error {
29 pub fn empty_attribute_key(value: impl Into<String>) -> Self {
30 Self::EmptyAttributeKey {
31 value: value.into(),
32 }
33 }
34
35 pub fn empty_attribute_value(key: impl Into<String>) -> Self {
36 Self::EmptyAttributeValue { key: key.into() }
37 }
38
39 pub fn reserved_attribute_key(key: impl Into<String>) -> Self {
40 Self::ReservedAttributeKey(key.into())
41 }
42
43 pub fn event_type_too_short(ty: impl Into<String>) -> Self {
44 Self::EventTypeTooShort(ty.into())
45 }
46}