cyber_std/
errors.rs

1use cosmwasm_std::{Decimal256RangeExceeded, DecimalRangeExceeded, OverflowError, StdError};
2use serde_json_wasm;
3use thiserror::Error;
4use crate::particle::ParticleError;
5
6#[derive(Error, Debug, PartialEq)]
7pub enum CyberError {
8    #[error("{0}")]
9    Std(#[from] StdError),
10
11    #[error("{0}")]
12    Fmt(#[from] std::fmt::Error),
13
14    #[error("{0}")]
15    FromUTF8Error(#[from] std::string::FromUtf8Error),
16
17    // #[error("Bech32 error")]
18    // Bech32(#[from] bech32::Error),
19
20    #[error("Prost protobuf error")]
21    ProstProtobuf(#[from] prost::DecodeError),
22
23    #[error("Serde JSON (Wasm) error")]
24    SerdeJSONWasm(String),
25
26    // ParticleError(#[from] ParticleError),
27}
28
29impl From<serde_json_wasm::de::Error> for CyberError {
30    fn from(e: serde_json_wasm::de::Error) -> Self {
31        CyberError::SerdeJSONWasm(e.to_string())
32    }
33}