Skip to content

Commit

Permalink
Nicolas/abs 547 remove unsued error variants (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayanski authored Oct 22, 2024
1 parent 85e972d commit 4818534
Show file tree
Hide file tree
Showing 38 changed files with 159 additions and 305 deletions.
1 change: 1 addition & 0 deletions framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ abstract-ica = { version = "0.24.1-beta.2", path = "packages/abstract-ica" }
abstract-sdk = { version = "0.24.1-beta.2", path = "packages/abstract-sdk" }
abstract-testing = { version = "0.24.1-beta.2", path = "packages/abstract-testing" }
abstract-std = { version = "0.24.1-beta.2", path = "packages/abstract-std" }
abstract-xion = { version = "0.24.1-beta.2", path = "packages/abstract-xion" }

# These should remain fixed and don't need to be re-published (unless changes are made)
abstract-macros = { version = "0.24.1-beta.2", path = "packages/abstract-macros" }
Expand Down
2 changes: 1 addition & 1 deletion framework/contracts/account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ abstract-macros = { workspace = true }

abstract-ica = { workspace = true }

abstract-xion = { version = "0.24.1-beta.2", path = "../../packages/abstract-xion", default-features = false, optional = true }
abstract-xion = { workspace = true, default-features = false, optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
workspace-hack = { version = "0.1", path = "../../workspace-hack" }
Expand Down
17 changes: 7 additions & 10 deletions framework/contracts/account/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use abstract_sdk::{std::objects::module::ModuleInfo, AbstractSdkError};
use abstract_sdk::std::objects::module::ModuleInfo;
use abstract_std::{
objects::{registry::RegistryError, validation::ValidationError},
AbstractError,
Expand All @@ -8,25 +8,22 @@ use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum AccountError {
#[error("{0}")]
#[error(transparent)]
Std(#[from] StdError),

#[error("{0}")]
#[error(transparent)]
Abstract(#[from] AbstractError),

#[error("{0}")]
AbstractSdk(#[from] AbstractSdkError),

#[error("{0}")]
#[error(transparent)]
Validation(#[from] ValidationError),

#[error("{0}")]
#[error(transparent)]
Ownership(#[from] abstract_std::objects::ownership::GovOwnershipError),

#[error("{0}")]
#[error(transparent)]
Instantiate2AddressError(#[from] Instantiate2AddressError),

#[error("{0}")]
#[error(transparent)]
RegistryError(#[from] RegistryError),

#[error("Your account is currently suspended")]
Expand Down
21 changes: 4 additions & 17 deletions framework/contracts/native/ans-host/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
use abstract_sdk::AbstractSdkError;
use abstract_std::AbstractError;
use cosmwasm_std::StdError;
use cw_asset::AssetError;
use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum AnsHostError {
#[error("{0}")]
#[error(transparent)]
Std(#[from] StdError),

#[error("{0}")]
#[error(transparent)]
Abstract(#[from] AbstractError),

#[error("{0}")]
AbstractSdk(#[from] AbstractSdkError),

#[error("{0}")]
#[error(transparent)]
Asset(#[from] AssetError),

#[error("{0}")]
#[error(transparent)]
Ownership(#[from] cw_ownable::OwnershipError),

#[error("You must provide exactly two assets when adding liquidity")]
NotTwoAssets {},

#[error("{} is not part of the provided pool", id)]
NotInPool { id: String },

#[error("{} assets is not within range [{}-{}]", provided, min, max)]
InvalidAssetCount {
min: usize,
Expand All @@ -39,7 +29,4 @@ pub enum AnsHostError {

#[error("Asset {} is not registered", asset)]
UnregisteredAsset { asset: String },

#[error("Dex {} is already registered", dex)]
DexAlreadyRegistered { dex: String },
}
24 changes: 6 additions & 18 deletions framework/contracts/native/ibc-client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,30 @@ use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum IbcClientError {
#[error("{0}")]
#[error(transparent)]
Std(#[from] StdError),

#[error("{0}")]
#[error(transparent)]
Abstract(#[from] AbstractError),

#[error("{0}")]
#[error(transparent)]
AbstractSdk(#[from] AbstractSdkError),

#[error("{0}")]
#[error(transparent)]
Ownership(#[from] cw_ownable::OwnershipError),

#[error("{0}")]
#[error(transparent)]
RegistryError(#[from] RegistryError),

#[error("{0}")]
#[error(transparent)]
AnsHostError(#[from] AnsHostError),

#[error("No account for chain {0}")]
UnregisteredChain(String),

#[error("remote account changed from {old} to {addr}")]
RemoteAccountChanged { addr: String, old: String },

#[error("Calling internal actions externally is not allowed")]
ForbiddenInternalCall {},

#[error("A non-module package (native or accounts) cannot execute an ibc module call")]
ForbiddenModuleCall {},

#[error("The host you are trying to connect is already connected")]
HostAlreadyExists {},

#[error("Only authorized ports can connect to the contract on the remote chain")]
UnauthorizedConnection {},

#[error("Unauthorized")]
Unauthorized {},

Expand Down
39 changes: 7 additions & 32 deletions framework/contracts/native/ibc-host/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,64 +1,39 @@
use abstract_sdk::AbstractSdkError;
use abstract_std::{
objects::{ans_host::AnsHostError, registry::RegistryError, AccountId},
objects::{ans_host::AnsHostError, registry::RegistryError},
AbstractError,
};
use cosmwasm_std::{Instantiate2AddressError, StdError};
use cw_ownable::OwnershipError;
use cw_utils::ParseReplyError;
use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum HostError {
#[error("{0}")]
#[error(transparent)]
Std(#[from] StdError),

#[error("{0}")]
#[error(transparent)]
Abstract(#[from] AbstractError),

#[error("{0}")]
AbstractSdk(#[from] AbstractSdkError),

#[error("This host does not implement any custom queries")]
NoCustomQueries,

#[error("{0}")]
#[error(transparent)]
OwnershipError(#[from] OwnershipError),

#[error("{0}")]
ParseReply(#[from] ParseReplyError),

#[error("{0}")]
#[error(transparent)]
RegistryError(#[from] RegistryError),

#[error("{0}")]
#[error(transparent)]
AnsHostError(#[from] AnsHostError),

#[error("{0}")]
#[error(transparent)]
Instantiate2AddressError(#[from] Instantiate2AddressError),

#[error("Semver parsing error: {0}")]
SemVer(String),

#[error("Expected port {0} got {1} instead.")]
ClientMismatch(String, String),

#[error("Chain or account address already registered.")]
ProxyAddressExists {},

#[error("Can't send a module-to-module packet to {0}, wrong module type")]
WrongModuleAction(String),

#[error("Missing module {module_info} on account {account_id}")]
MissingModule {
module_info: String,
account_id: AccountId,
},

#[error(
"You need to specify an account id for an account-specific module (apps and standalone)"
)]
AccountIdNotSpecified {},
}

impl From<semver::Error> for HostError {
Expand Down
14 changes: 5 additions & 9 deletions framework/contracts/native/ica-client/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use abstract_sdk::AbstractSdkError;
use abstract_std::{
objects::{ans_host::AnsHostError, registry::RegistryError},
AbstractError,
Expand All @@ -8,22 +7,19 @@ use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum IcaClientError {
#[error("{0}")]
#[error(transparent)]
Std(#[from] StdError),

#[error("{0}")]
#[error(transparent)]
Abstract(#[from] AbstractError),

#[error("{0}")]
AbstractSdk(#[from] AbstractSdkError),

#[error("{0}")]
#[error(transparent)]
Ownership(#[from] cw_ownable::OwnershipError),

#[error("{0}")]
#[error(transparent)]
RegistryError(#[from] RegistryError),

#[error("{0}")]
#[error(transparent)]
AnsHostError(#[from] AnsHostError),

#[error("chain {chain} has no associated type (evm/cosmos/...)")]
Expand Down
24 changes: 5 additions & 19 deletions framework/contracts/native/module-factory/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,39 +1,25 @@
use abstract_sdk::AbstractSdkError;
use abstract_std::{objects::registry::RegistryError, AbstractError};
use cosmwasm_std::{Instantiate2AddressError, StdError};
use cw_asset::AssetError;
use cw_ownable::OwnershipError;
use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum ModuleFactoryError {
#[error("{0}")]
#[error(transparent)]
Std(#[from] StdError),

#[error("{0}")]
#[error(transparent)]
Abstract(#[from] AbstractError),

#[error("{0}")]
AbstractSdk(#[from] AbstractSdkError),

#[error("{0}")]
Asset(#[from] AssetError),

#[error("{0}")]
#[error(transparent)]
Ownership(#[from] OwnershipError),

#[error("{0}")]
#[error(transparent)]
Instantiate2AddressError(#[from] Instantiate2AddressError),

#[error("{0}")]
#[error(transparent)]
RegistryError(#[from] RegistryError),

#[error("Calling contract is not a registered Account")]
UnknownCaller(),

#[error("Reply ID does not match any known Reply ID")]
UnexpectedReply(),

#[error("This module type can not be installed on your Account")]
ModuleNotInstallable {},
}
30 changes: 5 additions & 25 deletions framework/contracts/native/registry/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
use abstract_sdk::AbstractSdkError;
use abstract_std::{
objects::{module::ModuleInfo, namespace::Namespace, validation::ValidationError, AccountId},
AbstractError, ACCOUNT,
};
use cosmwasm_std::{Addr, Coin, StdError};
use cosmwasm_std::{Addr, StdError};
use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum RegistryError {
#[error("{0}")]
#[error(transparent)]
Std(#[from] StdError),

#[error("{0}")]
#[error(transparent)]
Abstract(#[from] AbstractError),

#[error("{0}")]
AbstractSdk(#[from] AbstractSdkError),

#[error("{0}")]
#[error(transparent)]
Validation(#[from] ValidationError),

#[error("{0}")]
#[error(transparent)]
Ownership(#[from] cw_ownable::OwnershipError),

#[error("Semver parsing error: {0}")]
Expand All @@ -44,9 +40,6 @@ pub enum RegistryError {
#[error("Module {0} does not have a stored module reference")]
ModuleNotFound(ModuleInfo),

#[error("Module {0} is in both approve and reject")]
InvalidApproveList(ModuleInfo),

#[error("Module {0} cannot be updated")]
NotUpdateableModule(ModuleInfo),

Expand All @@ -68,16 +61,6 @@ pub enum RegistryError {
#[error("Exceeds namespace limit: {}, current: {}", limit, current)]
ExceedsNamespaceLimit { limit: usize, current: usize },

#[error(
"Decreasing namespace limit is not allowed: {}, current: {}",
limit,
current
)]
DecreaseNamespaceLimit { limit: u32, current: u32 },

#[error("As namespace owner you can only yank a module, not remove it.")]
OnlyYankAllowed,

#[error("The admin of an adapter must be None")]
AdminMustBeNone,

Expand All @@ -87,9 +70,6 @@ pub enum RegistryError {
#[error("Account {0} already exists")]
AccountAlreadyExists(AccountId),

#[error("Invalid fee payment sent. Expected {}, sent {:?}", expected, sent)]
InvalidFeePayment { expected: Coin, sent: Vec<Coin> },

#[error("Initialization funds can only be specified for apps and standalone modules")]
RedundantInitFunds {},

Expand Down
8 changes: 1 addition & 7 deletions framework/packages/abstract-adapter/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum AdapterError {
#[error("{0}")]
#[error(transparent)]
Std(#[from] StdError),

#[error(transparent)]
Expand Down Expand Up @@ -36,10 +36,4 @@ pub enum AdapterError {

#[error("Maximum authorized addresses ({}) reached", max)]
TooManyAuthorizedAddresses { max: u32 },

#[error("This api does not implement any custom queries")]
NoCustomQueries,

#[error("No IBC receive handler function provided")]
MissingIbcReceiveHandler,
}
Loading

0 comments on commit 4818534

Please sign in to comment.