From 6a3e69eeaa5302c8d10f3e24e6c1cfdd679349b5 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 10 Mar 2021 19:06:27 +0100 Subject: [PATCH] errors: Add Wrap handy method --- types/errors/errors.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/errors/errors.go b/types/errors/errors.go index 1dcc63e6566..c635beb9761 100644 --- a/types/errors/errors.go +++ b/types/errors/errors.go @@ -257,6 +257,14 @@ func (e *Error) Is(err error) bool { } } +// Wrap extends this error with an additional information. +// It's a handy function to call Wrap with sdk errors. +func (e Error) Wrap(desc string) error { return Wrap(e, desc) } + +// Wrapf extends this error with an additional information. +// It's a handy function to call Wrapf with sdk errors. +func (e Error) Wrapf(desc string, args ...interface{}) error { return Wrapf(e, desc, args...) } + func isNilErr(err error) bool { // Reflect usage is necessary to correctly compare with // a nil implementation of an error.