mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
distribution: fallbackError, notFoundError implement go1.13 unwrapper
These errors implemented the Causer interface, but did not implement the go1.13 unwrapper, which could prevent errors from being matched. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -32,13 +32,17 @@ type fallbackError struct {
|
||||
|
||||
// Error renders the FallbackError as a string.
|
||||
func (f fallbackError) Error() string {
|
||||
return f.Cause().Error()
|
||||
return f.err.Error()
|
||||
}
|
||||
|
||||
func (f fallbackError) Cause() error {
|
||||
return f.err
|
||||
}
|
||||
|
||||
func (f fallbackError) Unwrap() error {
|
||||
return f.err
|
||||
}
|
||||
|
||||
type notFoundError struct {
|
||||
cause errcode.Error
|
||||
ref reference.Named
|
||||
@@ -64,6 +68,10 @@ func (e notFoundError) Cause() error {
|
||||
return e.cause
|
||||
}
|
||||
|
||||
func (e notFoundError) Unwrap() error {
|
||||
return e.cause
|
||||
}
|
||||
|
||||
// unsupportedMediaTypeError is an error issued when attempted
|
||||
// to pull unsupported content.
|
||||
type unsupportedMediaTypeError struct {
|
||||
|
||||
Reference in New Issue
Block a user