From 3971d2f4fd5d1feffb7ebc2885fd7a8133b494ee Mon Sep 17 00:00:00 2001 From: Viktor Liu Date: Fri, 13 Feb 2026 13:02:40 +0100 Subject: [PATCH] Consolidate duplicate timeout cases in classifyProxyError --- proxy/internal/proxy/reverseproxy.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/proxy/internal/proxy/reverseproxy.go b/proxy/internal/proxy/reverseproxy.go index 2e601e231..e8bd804ba 100644 --- a/proxy/internal/proxy/reverseproxy.go +++ b/proxy/internal/proxy/reverseproxy.go @@ -320,7 +320,8 @@ func getRequestID(r *http.Request) string { // status code, and component status based on the error type. func classifyProxyError(err error) (title, message string, code int, status web.ErrorStatus) { switch { - case errors.Is(err, context.DeadlineExceeded): + case errors.Is(err, context.DeadlineExceeded), + isNetTimeout(err): return "Request Timeout", "The request timed out while trying to reach the service. Please refresh the page and try again.", http.StatusGatewayTimeout, @@ -356,12 +357,6 @@ func classifyProxyError(err error) (title, message string, code int, status web. "The connection to the peer could not be established. Please ensure the peer is running and connected to the NetBird network.", http.StatusBadGateway, web.ErrorStatus{Proxy: true, Destination: false} - - case isNetTimeout(err): - return "Request Timeout", - "The request timed out while trying to reach the service. Please refresh the page and try again.", - http.StatusGatewayTimeout, - web.ErrorStatus{Proxy: true, Destination: false} } return "Connection Error",