-
Notifications
You must be signed in to change notification settings - Fork 115
/
error.rs
71 lines (58 loc) · 1.61 KB
/
error.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Error types
pub use eyre::{Report, Result};
use tendermint::Hash;
use thiserror::Error;
/// Kinds of errors.
#[derive(Clone, Debug, Error, PartialEq)]
pub enum Error {
/// Invalid account.
#[error("invalid account ID: {id:?}")]
AccountId {
/// Malformed account ID
id: String,
},
/// Cryptographic errors.
#[error("cryptographic error")]
Crypto,
/// Invalid decimal value.
#[error("invalid decimal value: {value:?}")]
Decimal {
/// Invalid decimal value
value: String,
},
/// Invalid denomination.
#[error("invalid denomination: {name:?}")]
Denom {
/// Invalid name
name: String,
},
/// Protobuf is missing a field.
#[error("missing proto field: {name:?}")]
MissingField {
/// Name of the missing field
name: &'static str,
},
/// Unexpected message type.
#[error("unexpected Msg type: {found:?}, expected {expected:?}")]
MsgType {
/// Expected type URL.
expected: &'static str,
/// Actual type URL found in the [`crate::Any`] message.
found: String,
},
/// Transaction not found.
#[error("transaction not found: {hash:?}")]
TxNotFound {
/// Transaction hash that wasn't found.
hash: Hash,
},
/// Invalid value for the given field of an enum.
#[error("invalid proto enum value: {name:?}, value: {found_value:?}")]
InvalidEnumValue {
/// Name of the enum field
name: &'static str,
/// Actual value of the field found
found_value: i32,
},
}
impl Eq for Error {}