MCPcopy
hub / github.com/mislav/hub / checkStatus

Function checkStatus

github/client.go:1157–1172  ·  view source on GitHub ↗
(expectedStatus int, action string, response *simpleResponse, err error)

Source from the content-addressed store, hash-verified

1155}
1156
1157func checkStatus(expectedStatus int, action string, response *simpleResponse, err error) error {
1158 if err != nil {
1159 errStr := err.Error()
1160 if urlErr, isURLErr := err.(*url.Error); isURLErr {
1161 errStr = fmt.Sprintf("%s %s: %s", urlErr.Op, urlErr.URL, urlErr.Err)
1162 }
1163 return fmt.Errorf("Error %s: %s", action, errStr)
1164 } else if response.StatusCode != expectedStatus {
1165 errInfo, err := response.ErrorInfo()
1166 if err != nil {
1167 return fmt.Errorf("Error %s: %s (HTTP %d)", action, err.Error(), response.StatusCode)
1168 }
1169 return FormatError(action, errInfo)
1170 }
1171 return nil
1172}
1173
1174// FormatError annotates an HTTP response error with user-friendly messages
1175func FormatError(action string, err error) error {

Callers 15

FetchPullRequestsMethod · 0.85
PullRequestMethod · 0.85
PullRequestPatchMethod · 0.85
CreatePullRequestMethod · 0.85
RequestReviewMethod · 0.85
CommitPatchMethod · 0.85
GistPatchMethod · 0.85
RepositoryMethod · 0.85
CreateRepositoryMethod · 0.85
DeleteRepositoryMethod · 0.85
FetchReleasesMethod · 0.85
CreateReleaseMethod · 0.85

Calls 4

FormatErrorFunction · 0.85
ErrorInfoMethod · 0.80
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…