From db68c99d4b41ff05f1dc6e1ecb784cdac9a85f79 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 4 Feb 2025 17:45:52 +0100 Subject: [PATCH] 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 --- distribution/errors.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/distribution/errors.go b/distribution/errors.go index b7d03088f7..91470eafe4 100644 --- a/distribution/errors.go +++ b/distribution/errors.go @@ -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 {