From 379a2571ba76c0fd33af5ddcdcb6ea6099f5c305 Mon Sep 17 00:00:00 2001 From: Felix Leupold Date: Tue, 29 Aug 2023 21:53:16 +0100 Subject: [PATCH] Properly classify Paraswap rate limits (#1824) Paraswap rate limit responses are currently not properly converted into rate limit errors. This PR replaces the catch all case in the enum to make sure the compiler forces us to think about this conversion if we add another Paraswap error type. --- crates/shared/src/trade_finding/paraswap.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/shared/src/trade_finding/paraswap.rs b/crates/shared/src/trade_finding/paraswap.rs index 59c16e1894..19b7123514 100644 --- a/crates/shared/src/trade_finding/paraswap.rs +++ b/crates/shared/src/trade_finding/paraswap.rs @@ -174,7 +174,11 @@ impl From for TradeError { fn from(err: ParaswapResponseError) -> Self { match err { ParaswapResponseError::InsufficientLiquidity(_) => Self::NoLiquidity, - _ => Self::Other(err.into()), + ParaswapResponseError::RateLimited => Self::RateLimited, + ParaswapResponseError::Request(_) + | ParaswapResponseError::Json(_) + | ParaswapResponseError::Retryable(_) + | ParaswapResponseError::Other(_) => Self::Other(err.into()), } } }