abstract_os/
error.rs

1use cosmwasm_std::{OverflowError, StdError};
2use cw_asset::AssetError;
3use cw_semver::Error as CwSemverError;
4use semver::Error as SemverError;
5use thiserror::Error;
6
7/// Wrapper error for the Abstract-OS framework.
8#[derive(Error, Debug, PartialEq)]
9pub enum AbstractOsError {
10    #[error("Std error encountered while handling os object: {0}")]
11    Std(#[from] StdError),
12
13    #[error("{0}")]
14    Asset(#[from] AssetError),
15
16    #[error("cw math overflow error: {0}")]
17    Overflow(#[from] OverflowError),
18
19    #[error("Semver error encountered while handling os object: {0}")]
20    Semver(String),
21
22    #[error("Entry {actual} should be formatted as {expected}")]
23    EntryFormattingError { actual: String, expected: String },
24
25    #[error("Object {object} should be formatted {expected} but is {actual}")]
26    FormattingError {
27        object: String,
28        expected: String,
29        actual: String,
30    },
31
32    #[error("API {0} not installed on OS")]
33    ApiNotInstalled(String),
34
35    #[error("App {0} not installed on OS")]
36    AppNotInstalled(String),
37
38    #[error("version for {0} in missing")]
39    MissingVersion(String),
40
41    #[error("Abstract storage object {object} errors with {msg}")]
42    Storage { object: String, msg: String },
43
44    #[error("assertion: {0}")]
45    Assert(String),
46
47    //fee error
48    #[error("fee error: {0}")]
49    Fee(String),
50
51    // deposit error
52    #[error("deposit error: {0}")]
53    Deposit(String),
54}
55
56impl From<SemverError> for AbstractOsError {
57    fn from(err: SemverError) -> Self {
58        AbstractOsError::Semver(err.to_string())
59    }
60}
61
62impl From<CwSemverError> for AbstractOsError {
63    fn from(err: CwSemverError) -> Self {
64        AbstractOsError::Semver(err.to_string())
65    }
66}