From 606006b9318e235c7e11f76e2ae8062526dad55c Mon Sep 17 00:00:00 2001 From: Kiskae Date: Fri, 10 Nov 2023 10:53:45 +0000 Subject: [PATCH] Pass through HTTP 429 to the nix daemon --- magic-nix-cache/src/error.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/magic-nix-cache/src/error.rs b/magic-nix-cache/src/error.rs index 9b99701..07b5fe6 100644 --- a/magic-nix-cache/src/error.rs +++ b/magic-nix-cache/src/error.rs @@ -29,6 +29,10 @@ pub enum Error { impl IntoResponse for Error { fn into_response(self) -> Response { let code = match &self { + Self::Api(gha_cache::api::Error::ApiError { + status: StatusCode::TOO_MANY_REQUESTS, + .. + }) => StatusCode::TOO_MANY_REQUESTS, // HACK: HTTP 418 makes Nix throw a visible error but not retry Self::Api(_) => StatusCode::IM_A_TEAPOT, Self::NotFound => StatusCode::NOT_FOUND,