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

Function newUploadError

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

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

Callers 1

uploadMethod · 0.85

Calls 2

PathMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected