Skip to content

Commit

Permalink
adding oops.Join()
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Jul 9, 2024
1 parent a4e9c60 commit e81a127
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ func (o OopsErrorBuilder) Errorf(format string, args ...any) error {
return OopsError(o2)
}

func (o OopsErrorBuilder) Join(e ...error) error {
return o.Wrap(errors.Join(e...))
}

// Recover handle panic and returns `oops.OopsError` object that satisfies `error`.
func (o OopsErrorBuilder) Recover(cb func()) (err error) {
defer func() {
Expand Down Expand Up @@ -181,10 +185,6 @@ func (o OopsErrorBuilder) Assertf(condition bool, msg string, args ...any) OopsE
return o // no need to copy
}

func (o OopsErrorBuilder) Join(e ...error) error {
return o.Wrap(errors.Join(e...))
}

// Code set a code or slug that describes the error.
// Error messages are intented to be read by humans, but such code is expected to
// be read by machines and even transported over different services.
Expand Down
4 changes: 4 additions & 0 deletions oops.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ func Errorf(format string, args ...any) error {
return new().Errorf(format, args...)
}

func Join(e ...error) error {
return new().Join(e...)
}

// Recover handle panic and returns `oops.OopsError` object that satisfies `error`.
func Recover(cb func()) (err error) {
return new().Recover(cb)
Expand Down

0 comments on commit e81a127

Please sign in to comment.