From 823c0140362292ebb64ad468503b4ed8264a5e7b Mon Sep 17 00:00:00 2001 From: Kevin de Berk Date: Mon, 15 Nov 2021 15:25:32 +0100 Subject: [PATCH] Unwrap for ValidationError (#125) --- errors.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/errors.go b/errors.go index f309878..b9d18e4 100644 --- a/errors.go +++ b/errors.go @@ -53,6 +53,11 @@ func (e ValidationError) Error() string { } } +// Unwrap gives errors.Is and errors.As access to the inner error. +func (e *ValidationError) Unwrap() error { + return e.Inner +} + // No errors func (e *ValidationError) valid() bool { return e.Errors == 0