MCPcopy Create free account
hub / github.com/aptly-dev/aptly / retryableError

Function retryableError

http/download.go:127–155  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

125}
126
127func retryableError(err error) bool {
128 // unwrap errors.Wrap
129 err = errors.Cause(err)
130
131 // unwrap *url.Error
132 if wrapped, ok := err.(*url.Error); ok {
133 err = wrapped.Err
134 }
135
136 switch err {
137 case context.Canceled:
138 return false
139 case io.EOF:
140 return true
141 case io.ErrUnexpectedEOF:
142 return true
143 }
144
145 switch err.(type) {
146 case *net.OpError:
147 return true
148 case syscall.Errno:
149 return true
150 case net.Error:
151 return true
152 }
153 // Note: make all errors retryable
154 return true
155}
156
157func (downloader *downloaderImpl) newRequest(ctx context.Context, method, url string) (*http.Request, error) {
158 req, err := http.NewRequest(method, url, nil)

Callers 3

DownloadWithChecksumMethod · 0.85
GetLengthMethod · 0.85
DownloadWithChecksumMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected