From 6345364402a2c6742b4032c56ab4ef96bf3fae34 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 22 Feb 2023 13:24:23 +0100 Subject: [PATCH] fix: keep context deadline exceeded as last --- gateway/handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gateway/handler.go b/gateway/handler.go index c61b49ff2..82adbe5c3 100644 --- a/gateway/handler.go +++ b/gateway/handler.go @@ -572,12 +572,12 @@ func webError(w http.ResponseWriter, message string, err error, defaultCode int) webErrorWithCode(w, message, err, http.StatusNotFound) } else if ipld.IsNotFound(err) { webErrorWithCode(w, message, err, http.StatusNotFound) - } else if errors.Is(err, context.DeadlineExceeded) || err == context.DeadlineExceeded { - webErrorWithCode(w, message, err, http.StatusRequestTimeout) } else if errors.Is(err, ErrGatewayTimeout) { webErrorWithCode(w, message, err, http.StatusGatewayTimeout) } else if errors.Is(err, ErrBadGateway) { webErrorWithCode(w, message, err, http.StatusBadGateway) + } else if errors.Is(err, context.DeadlineExceeded) || err == context.DeadlineExceeded { + webErrorWithCode(w, message, err, http.StatusRequestTimeout) } else { webErrorWithCode(w, message, err, defaultCode) }