You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/vendor/github.com/gobuffalo/packd/internal/takeon/github.com/markbates/errx/errx.go

24 lines
290 B

package errx
// go2 errors
type Wrapper interface {
Unwrap() error
}
// pkg/errors
type Causer interface {
Cause() error
}
func Unwrap(err error) error {
switch e := err.(type) {
case Wrapper:
return e.Unwrap()
case Causer:
return e.Cause()
}
return err
}
var Cause = Unwrap