Make RegistryConfig a typed value in the api.
Remove possible circular dependency that prevented us from using a real type. Signed-off-by: David Calavera <david.calavera@gmail.com> Upstream-commit: 719886d4352cba3f2cd0092e052bb4cb67d51417 Component: engine
This commit is contained in:
21
components/engine/utils/timeout.go
Normal file
21
components/engine/utils/timeout.go
Normal file
@ -0,0 +1,21 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// IsTimeout takes an error returned from (generally) the http package and determines if it is a timeout error.
|
||||
func IsTimeout(err error) bool {
|
||||
switch e := err.(type) {
|
||||
case net.Error:
|
||||
return e.Timeout()
|
||||
case *url.Error:
|
||||
if t, ok := e.Err.(net.Error); ok {
|
||||
return t.Timeout()
|
||||
}
|
||||
return false
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user