-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy patherror.rs
45 lines (41 loc) · 1.52 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
use cosmwasm_std::{StdError, VerificationError};
use ibc_union_light_client::IbcClientError;
use unionlabs::ibc::core::client::height::Height;
use crate::client::MovementLightClient;
#[derive(thiserror::Error, Debug, PartialEq)]
pub enum Error {
#[error("header verification failure ({0})")]
HeaderVerification(#[from] aptos_verifier::Error),
#[error("invalid state_proof storage proof")]
InvalidStateProof,
#[error("empty ibc path")]
EmptyIbcPath,
#[error("consensus state not found ({0})")]
ConsensusStateNotFound(Height),
#[error("membership proof with no value")]
MembershipProofWithoutValue,
#[error("proof value {proof_value} doesn't match the given value {given})", proof_value = serde_utils::to_hex(.0), given = serde_utils::to_hex(.1))]
ProofValueMismatch(Vec<u8>, Vec<u8>),
#[error("proof value hash doesn't match the calculated one")]
ProofValueHashMismatch,
#[error("proof key hash doesn't match the calculated one")]
ProofKeyMismatch,
#[error("invalid ibc path {0}")]
InvalidIbcPath(String),
#[error(transparent)]
StdError(#[from] StdError),
#[error("authentication failure")]
AuthenticationFailure,
#[error(transparent)]
VerificationError(#[from] VerificationError),
}
impl From<Error> for StdError {
fn from(value: Error) -> Self {
StdError::generic_err(value.to_string())
}
}
impl From<Error> for IbcClientError<MovementLightClient> {
fn from(value: Error) -> Self {
IbcClientError::ClientSpecific(value)
}
}