MCPcopy Create free account
hub / github.com/cli/cli / UnexpectedStatusError

Function UnexpectedStatusError

api/client.go:296–301  ·  view source on GitHub ↗

UnexpectedStatusError reports a successful response whose status the caller did not expect. The request methods on Client convert every non-2xx response into an HTTPError, so a call site that requires one specific status can only ever be surprised by a different 2xx. Passing such a response to Hand

(resp *http.Response)

Source from the content-addressed store, hash-verified

294// response to HandleHTTPError would ask an error parser to explain a success, so this is used
295// instead. The caller remains responsible for closing the response body stream.
296func UnexpectedStatusError(resp *http.Response) error {
297 if resp.Request != nil {
298 return fmt.Errorf("unexpected HTTP %d for %s %s", resp.StatusCode, resp.Request.Method, resp.Request.URL)
299 }
300 return fmt.Errorf("unexpected HTTP %d", resp.StatusCode)
301}
302
303// handleRequestError converts a request error into an HTTPError or GraphQLError, first adding any
304// endpoint scopes to the error's headers so that the scopes suggestion generated by handleResponse

Callers 13

publishedReleaseExistsFunction · 0.92
GetScopesFunction · 0.92
GetRawGistFileFunction · 0.92
getTopicsFunction · 0.92
setTopicsFunction · 0.92
GetLogMethod · 0.92
getLogFunction · 0.92
fetchDiffFunction · 0.92
repoExistsFunction · 0.92
getLatestReleaseInfoFunction · 0.92
RevokeTokenFunction · 0.92

Calls 1

ErrorfMethod · 0.65

Tested by 1