Skip to content

Commit

Permalink
Properly classify Paraswap rate limits (#1824)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fleupold authored Aug 29, 2023
1 parent 234bbf9 commit 379a257
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/shared/src/trade_finding/paraswap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ impl From<ParaswapResponseError> 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()),
}
}
}
Expand Down

0 comments on commit 379a257

Please sign in to comment.