1use cosmwasm_std::StdError;
2use cw_asset::AssetError;
3use semver::Version;
4use thiserror::Error;
5
6use crate::objects::{ans_host::AnsHostError, registry::RegistryError};
7
8#[derive(Error, Debug, PartialEq)]
10pub enum AbstractError {
11 #[error("Std error encountered while handling account object: {0}")]
12 Std(#[from] StdError),
13
14 #[error(transparent)]
15 Asset(#[from] AssetError),
16
17 #[error(transparent)]
18 RegistryError(#[from] RegistryError),
19
20 #[error(transparent)]
21 AnsHostError(#[from] AnsHostError),
22
23 #[error(transparent)]
24 Instantiate2AddressError(#[from] cosmwasm_std::Instantiate2AddressError),
25
26 #[error("Semver error encountered while handling account object: {0}")]
27 Semver(String),
28
29 #[error("Entry {actual} should be formatted as {expected}")]
30 EntryFormattingError { actual: String, expected: String },
31
32 #[error("Object {object} should be formatted {expected} but is {actual}")]
33 FormattingError {
34 object: String,
35 expected: String,
36 actual: String,
37 },
38
39 #[error("Cannot downgrade contract {} from {} to {}", contract, from, to)]
40 CannotDowngradeContract {
41 contract: String,
42 from: Version,
43 to: Version,
44 },
45
46 #[error("Cannot rename contract from {} to {}", from, to)]
47 ContractNameMismatch { from: String, to: String },
48
49 #[error("App {0} not installed on Account")]
50 AppNotInstalled(String),
51
52 #[error("version for {0} in missing")]
53 MissingVersion(String),
54
55 #[error("assertion: {0}")]
56 Assert(String),
57
58 #[error("fee error: {0}")]
60 Fee(String),
61
62 #[error("The version or name of this module was not consistent between its stores (cw2: {cw2} and abstract module data: {module}).")]
63 UnequalModuleData { cw2: String, module: String },
64
65 #[error("Cannot Skip module version {contract} from {from} to {to}")]
66 CannotSkipVersion {
67 contract: String,
68 from: Version,
69 to: Version,
70 },
71}
72
73impl From<semver::Error> for AbstractError {
74 fn from(err: semver::Error) -> Self {
75 AbstractError::Semver(err.to_string())
76 }
77}