Skip to content

Commit 4bd695d

Browse files
robert-zarembaAlessio Tregliamergify[bot]
authored
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>
1 parent e66c4e6 commit 4bd695d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

types/errors/errors.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ func (e *Error) Is(err error) bool {
257257
}
258258
}
259259

260+
// Wrap extends this error with an additional information.
261+
// It's a handy function to call Wrap with sdk errors.
262+
func (e Error) Wrap(desc string) error { return Wrap(e, desc) }
263+
264+
// Wrapf extends this error with an additional information.
265+
// It's a handy function to call Wrapf with sdk errors.
266+
func (e Error) Wrapf(desc string, args ...interface{}) error { return Wrapf(e, desc, args...) }
267+
260268
func isNilErr(err error) bool {
261269
// Reflect usage is necessary to correctly compare with
262270
// a nil implementation of an error.

0 commit comments

Comments
 (0)