MCPcopy Create free account
hub / github.com/algolia/cli / parseOAuthError

Function parseOAuthError

api/dashboard/client.go:649–661  ·  view source on GitHub ↗
(resp *http.Response, context string)

Source from the content-addressed store, hash-verified

647}
648
649func parseOAuthError(resp *http.Response, context string) error {
650 body, err := io.ReadAll(resp.Body)
651 if err != nil {
652 return fmt.Errorf("%s failed with status %d", context, resp.StatusCode)
653 }
654
655 var oauthErr OAuthErrorResponse
656 if json.Unmarshal(body, &oauthErr) == nil && oauthErr.ErrorDescription != "" {
657 return fmt.Errorf("%s: %s", context, oauthErr.ErrorDescription)
658 }
659
660 return fmt.Errorf("%s failed with status %d: %s", context, resp.StatusCode, string(body))
661}

Callers 3

RefreshTokenMethod · 0.85
RevokeTokenMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected