cycles-quartz/bisenzone-cw-mvp/contracts/cw-tee-mtcs/src/error.rs

35 lines
647 B
Rust
Raw Normal View History

2023-11-29 21:13:20 +00:00
use cosmwasm_std::StdError;
2023-12-05 17:03:43 +00:00
use hex::FromHexError;
use k256::ecdsa::Error as K256Error;
2023-11-29 21:13:20 +00:00
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ContractError {
#[error("{0}")]
Std(#[from] StdError),
#[error("Unauthorized")]
Unauthorized,
2023-11-29 22:09:57 +00:00
2023-12-05 17:03:43 +00:00
#[error("Not Secp256K1")]
K256(K256Error),
2023-12-22 13:10:51 +00:00
2023-12-05 17:03:43 +00:00
#[error("Invalid hex")]
Hex(FromHexError),
2023-12-22 13:10:51 +00:00
#[error("Invalid length")]
BadLength,
2023-11-29 21:13:20 +00:00
}
2023-12-05 17:03:43 +00:00
2023-12-22 13:10:51 +00:00
impl From<K256Error> for ContractError {
2023-12-05 17:03:43 +00:00
fn from(e: K256Error) -> Self {
2023-12-22 13:10:51 +00:00
ContractError::K256(e)
2023-12-05 17:03:43 +00:00
}
}
2023-12-22 13:10:51 +00:00
impl From<FromHexError> for ContractError {
2023-12-05 17:03:43 +00:00
fn from(e: FromHexError) -> Self {
2023-12-22 13:10:51 +00:00
ContractError::Hex(e)
2023-12-05 17:03:43 +00:00
}
}