From 974a9ad7cf73ed13280c39b6281a6029d4c491da Mon Sep 17 00:00:00 2001 From: MBarwicki Date: Thu, 2 Nov 2023 16:30:24 +0100 Subject: [PATCH] Fix the rate limiter code to enable build --- api/src/rate_limiter.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/rate_limiter.rs b/api/src/rate_limiter.rs index 573163d3..5b3d42df 100644 --- a/api/src/rate_limiter.rs +++ b/api/src/rate_limiter.rs @@ -115,7 +115,7 @@ impl<'r> FromRequest<'r> for RateLimited { async fn from_request(request: &'r Request<'_>) -> Outcome { let rate_limiter: &RateLimiter = match request.rocket().state() { None => { - return Outcome::Failure(( + return Outcome::Error(( Status::InternalServerError, ApiError::RateLimiterNotInState, )) @@ -124,13 +124,13 @@ impl<'r> FromRequest<'r> for RateLimited { }; let client_ip = match request.client_ip() { - None => return Outcome::Failure((Status::BadRequest, ApiError::FailedToGetClientIp)), + None => return Outcome::Error((Status::BadRequest, ApiError::FailedToGetClientIp)), Some(x) => x, }; match rate_limiter.do_rate_limit(client_ip) { Ok(_) => Outcome::Success(RateLimited), - Err(_) => Outcome::Failure((Status::TooManyRequests, ApiError::TooManyRequests)), + Err(_) => Outcome::Error((Status::TooManyRequests, ApiError::TooManyRequests)), } } }