errors: Add Wrap handy method (#8845)

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Robert Zaremba 2021-03-16 02:09:31 +01:00 committed by GitHub
parent e66c4e6f9c
commit 4bd695de4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -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 { func isNilErr(err error) bool {
// Reflect usage is necessary to correctly compare with // Reflect usage is necessary to correctly compare with
// a nil implementation of an error. // a nil implementation of an error.