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:
Sebastiaan van Stijn
2025-02-04 17:45:52 +01:00
parent b96b14d078
commit db68c99d4b

View File

@@ -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 {