Pass through HTTP 429 to the nix daemon

This commit is contained in:
Kiskae 2023-11-10 10:53:45 +00:00
parent 369a0a0a5a
commit 606006b931

View file

@ -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,