From 1e68fdcefd0e9907b5c89fed39ad2cb76432d97f Mon Sep 17 00:00:00 2001 From: nahem Date: Mon, 5 Feb 2024 17:00:22 +0100 Subject: [PATCH] feat(smart-contracts): add verbose error when trying to remove a swap route that does not exist --- .../pool-network/terraswap_router/src/contract.rs | 5 ++++- .../liquidity_hub/pool-network/terraswap_router/src/error.rs | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/liquidity_hub/pool-network/terraswap_router/src/contract.rs b/contracts/liquidity_hub/pool-network/terraswap_router/src/contract.rs index 47a95028..d2a2dfdb 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_router/src/contract.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_router/src/contract.rs @@ -281,7 +281,10 @@ pub fn remove_swap_routes( swap_route_key.remove(deps.storage); attributes.push(attr("swap_route", swap_route.clone().to_string())); } else { - return Err(ContractError::NoRouteFound {}); + return Err(ContractError::NoSwapRouteForAssets { + offer_asset: swap_route.offer_asset_info.get_label(&deps.as_ref())?, + ask_asset: swap_route.ask_asset_info.get_label(&deps.as_ref())?, + }); } } diff --git a/contracts/liquidity_hub/pool-network/terraswap_router/src/error.rs b/contracts/liquidity_hub/pool-network/terraswap_router/src/error.rs index c9442f21..3341af83 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_router/src/error.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_router/src/error.rs @@ -45,9 +45,6 @@ pub enum ContractError { #[error("Unauthorized")] Unauthorized {}, - - #[error("Cannot remove a route that does not exist")] - NoRouteFound {}, } impl From for ContractError {