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

Function newUploadError

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

153// newUploadError captures the status code so the message can name what the
154// endpoint refused.
155func newUploadError(err error, a UserAsset) error {
156 uploadErr := &uploadError{Path: a.Path(), err: err}
157 if httpError, ok := errors.AsType[api.HTTPError](err); ok {
158 uploadErr.StatusCode = httpError.StatusCode
159 uploadErr.Message = httpError.Message
160 uploadErr.RetryAfter = httpError.Headers.Get("Retry-After")
161 }
162 return uploadErr
163}
164
165// uploadError reports a failed upload. StatusCode is zero when the request
166// never reached the server.

Callers 1

uploadMethod · 0.85

Calls 2

PathMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected