From 35ec689069e46c74c7cfdf55f1b1c91c6239bce5 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Mon, 9 Mar 2026 09:44:31 +0000 Subject: [PATCH] appview/oauth: improve logging for default knot failures Signed-off-by: oppiliappan --- appview/oauth/handler.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/appview/oauth/handler.go b/appview/oauth/handler.go index 15e8b2f8..971b741d 100644 --- a/appview/oauth/handler.go +++ b/appview/oauth/handler.go @@ -346,7 +346,11 @@ func (s *AppPasswordSession) putRecord(record any, collection string) error { defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return fmt.Errorf("failed to add user to default service: HTTP %d", resp.StatusCode) + var errorResponse map[string]any + if err := json.NewDecoder(resp.Body).Decode(&errorResponse); err != nil { + return fmt.Errorf("failed to add user to default service: HTTP %d (failed to decode error response: %w)", resp.StatusCode, err) + } + return fmt.Errorf("failed to add user to default service: HTTP %d, response: %v", resp.StatusCode, errorResponse) } return nil -- 2.51.2