Skip to content

Commit

Permalink
Merge pull request #838 from Scalingo/fix/errors/deprecate_errgo
Browse files Browse the repository at this point in the history
docs(errors): deprecate use of `errgo` in `ErrCtx`
  • Loading branch information
EtienneM authored Feb 14, 2024
2 parents 6a50320 + 50ee664 commit 812847e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions errors/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## To be Released

* docs(errors): deprecate use of `errgo` in `ErrCtx`

## v2.3.0

* feat: add `Is` and `As` to match standard library
Expand Down
5 changes: 3 additions & 2 deletions errors/errctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ func (err ErrCtx) Unwrap() error {
}

func New(ctx context.Context, message string) error {
return ErrCtx{ctx: ctx, err: errgo.New(message)}
return ErrCtx{ctx: ctx, err: errors.New(message)}
}

func Newf(ctx context.Context, format string, args ...interface{}) error {
return ErrCtx{ctx: ctx, err: errgo.Newf(format, args...)}
return Errorf(ctx, format, args...)
}

// Deprecated: Use `Wrap` or `Wrapf` instead of `Notef`. The library is able to unwrap mixed errors (wrapped with `errgo` or `github.com/pkg/errors`).
func Notef(ctx context.Context, err error, format string, args ...interface{}) error {
return ErrCtx{ctx: ctx, err: errgo.Notef(err, format, args...)}
}
Expand Down

0 comments on commit 812847e

Please sign in to comment.