Skip to content
Permalink
Browse files

Merge pull request #15 from dennwc/unwrap

Implement Unwrap method for error values
  • Loading branch information...
smola committed Sep 30, 2019
2 parents 01e8bea + 0e18a37 commit 2646ff0d8e9968b3ace5eecd1c34b8d8a64ddd64
Showing with 6 additions and 0 deletions.
  1. +6 −0 error.go
@@ -72,6 +72,12 @@ func (err *Error) Cause() error {
return err.cause
}

// Unwrap returns the underlying cause of the error.
// It implements a new optional error interface introduced in Go 1.13.
func (err *Error) Unwrap() error {
return err.cause
}

func (err *Error) Error() string {
if err.cause == nil {
return err.message

0 comments on commit 2646ff0

Please sign in to comment.
You can’t perform that action at this time.