From 7cda0ca55b5ade22e15ebc824eb2c8d43172edd3 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 f309878b..b9d18e49 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