From 4bd695de4ec6115e83a73e48f942a268ccdc4d64 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 16 Mar 2021 02:09:31 +0100 Subject: [PATCH] errors: Add Wrap handy method (#8845) Co-authored-by: Alessio Treglia Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- types/errors/errors.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/errors/errors.go b/types/errors/errors.go index 1dcc63e656..c635beb976 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.