Monorepo for Tangled

appview/oauth: improve logging for default knot failures

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li 35ec6890 1b314963

verified
+5 -1
+5 -1
appview/oauth/handler.go
··· 346 defer resp.Body.Close() 347 348 if resp.StatusCode != http.StatusOK { 349 - return fmt.Errorf("failed to add user to default service: HTTP %d", resp.StatusCode) 350 } 351 352 return nil
··· 346 defer resp.Body.Close() 347 348 if resp.StatusCode != http.StatusOK { 349 + var errorResponse map[string]any 350 + if err := json.NewDecoder(resp.Body).Decode(&errorResponse); err != nil { 351 + return fmt.Errorf("failed to add user to default service: HTTP %d (failed to decode error response: %w)", resp.StatusCode, err) 352 + } 353 + return fmt.Errorf("failed to add user to default service: HTTP %d, response: %v", resp.StatusCode, errorResponse) 354 } 355 356 return nil