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

Function newUploadError

internal/attachments/client.go:178–186  ·  view source on GitHub ↗

newUploadError captures the status code so the message can name what the endpoint refused.

(err error, a UserAsset)

Source from the content-addressed store, hash-verified

176// newUploadError captures the status code so the message can name what the
177// endpoint refused.
178func newUploadError(err error, a UserAsset) error {
179 uploadErr := &uploadError{Path: a.Path(), err: err}
180 if httpError, ok := errors.AsType[api.HTTPError](err); ok {
181 uploadErr.StatusCode = httpError.StatusCode
182 uploadErr.Message = httpError.Message
183 uploadErr.RetryAfter = httpError.Headers.Get("Retry-After")
184 }
185 return uploadErr
186}
187
188// uploadError reports a failed upload. StatusCode is zero when the request
189// never reached the server.

Callers 1

uploadMethod · 0.85

Calls 2

PathMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected