diff --git a/context_errors.go b/context_errors.go index c3443fb..5f900e8 100644 --- a/context_errors.go +++ b/context_errors.go @@ -2,6 +2,8 @@ package errors import ( "context" + + "github.com/pkg/errors" ) // ContextError represents a standard error @@ -18,6 +20,14 @@ func WrapWithContext(err error, ctx context.Context) *ContextError { } } +func WrapConext(err error, ctx context.Context, message string) *ContextError { + return WrapWithContext(errors.Wrap(err, message), ctx) +} + +func WrapfConext(err error, ctx context.Context, format string, args ...interface{}) *ContextError { + return WrapWithContext(errors.Wrapf(err, format, args...), ctx) +} + func (ce *ContextError) Error() string { return ce.Err.Error() }