From fa020d0fc292d5c381c57ecac6666d9ff657e4c4 Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Mon, 28 Oct 2024 22:22:23 +0800 Subject: [PATCH] fix: improve error messaging for http hooks (#1821) ## What kind of change does this PR introduce? * HTTP hooks that return status codes outside of the accepted status codes will cause Auth to return an obscure error message that is hard to debug: `Error executing Hook` - this change is an attempt to improve the error messaging to reflect the status code being rejected ## What is the current behavior? Please link any relevant issues here. ## What is the new behavior? Feel free to include screenshots if it includes visual changes. ## Additional context Add any other context or screenshots. --- internal/api/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/hooks.go b/internal/api/hooks.go index 3a5512d40..14e2b3cd4 100644 --- a/internal/api/hooks.go +++ b/internal/api/hooks.go @@ -179,7 +179,7 @@ func (a *API) runHTTPHook(r *http.Request, hookConfig conf.ExtensibilityPointCon case http.StatusUnauthorized: return nil, internalServerError("Hook requires authorization token") default: - return nil, internalServerError("Error executing Hook") + return nil, internalServerError("Unexpected status code returned from hook: %d", rsp.StatusCode) } } return nil, nil