Skip to content

Commit

Permalink
Add unwrap methods for errors (#18)
Browse files Browse the repository at this point in the history
* Add unwrap methods for errors

* Update comments
  • Loading branch information
ilya-hontarau authored Jun 19, 2024
1 parent 6391049 commit a6f15b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bugsnag.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ type errorWithStackFrames struct {
err stackTracer
}

// Cause returns initial error, provides compatibility for pkg/errors chains.
func (w *errorWithStackFrames) Cause() error { return w.err }

// Unwrap returns initial error, provides compatibility for Go 1.13 error chains.
func (w *errorWithStackFrames) Unwrap() error { return w.err }

func (e *errorWithStackFrames) Error() string {
return e.err.Error()
}
Expand Down

0 comments on commit a6f15b8

Please sign in to comment.