MCPcopy Index your code
hub / github.com/google/go-github / parseBoolResponse

Function parseBoolResponse

github/github.go:1794–1807  ·  view source on GitHub ↗

parseBoolResponse determines the boolean result from a GitHub API response. Several GitHub API methods return boolean responses indicated by the HTTP status code in the response (true indicated by a 204, false indicated by a 404). This helper function will determine that result and hide the 404 erro

(err error)

Source from the content-addressed store, hash-verified

1792// 404). This helper function will determine that result and hide the 404
1793// error if present. Any other error will be returned through as-is.
1794func parseBoolResponse(err error) (bool, error) {
1795 if err == nil {
1796 return true, nil
1797 }
1798
1799 var rerr *ErrorResponse
1800 if errors.As(err, &rerr) && rerr.Response.StatusCode == http.StatusNotFound {
1801 // Simply false. In this one case, we do not pass the error through.
1802 return false, nil
1803 }
1804
1805 // some other real error occurred
1806 return false, err
1807}
1808
1809// RateLimitCategory represents the enumeration of rate limit categories.
1810type RateLimitCategory uint8

Callers 15

IsCollaboratorMethod · 0.85
IsStarredMethod · 0.85
IsBlockedMethod · 0.85
IsAssigneeMethod · 0.85
IsMemberMethod · 0.85
IsPublicMemberMethod · 0.85
IsFollowingMethod · 0.85

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…