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

Function newUploadError

internal/attachments/client.go:179–187  ·  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

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

Callers 1

uploadMethod · 0.85

Calls 2

PathMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected