From b090c73bd480874585c3d9b8eb8d27b6788f7b83 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 18 Sep 2016 13:28:59 +0200 Subject: [PATCH] Remove wrapper functions in errors package This way, our own errors package does not appear in the stack traces. --- src/restic/errors/wrap.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/restic/errors/wrap.go b/src/restic/errors/wrap.go index 65b48de8b..5906bd617 100644 --- a/src/restic/errors/wrap.go +++ b/src/restic/errors/wrap.go @@ -7,17 +7,14 @@ func Cause(err error) error { return errors.Cause(err) } -// New creates a new error based on message. -func New(message string) error { - return errors.New(message) -} +// New creates a new error based on message. Wrapped so that this package does +// not appear in the stack trace. +var New = errors.New -// Errorf creates an error based on a format string and values. -func Errorf(format string, args ...interface{}) error { - return errors.Errorf(format, args...) -} +// Errorf creates an error based on a format string and values. Wrapped so that +// this package does not appear in the stack trace. +var Errorf = errors.Errorf -// Wrap wraps an error retrieved from outside of restic. -func Wrap(err error, message string) error { - return errors.Wrap(err, message) -} +// Wrap wraps an error retrieved from outside of restic. Wrapped so that this +// package does not appear in the stack trace. +var Wrap = errors.Wrap