github.com/yandex/pandora@v0.5.32/lib/errutil/errutil.go (about) 1 package errutil 2 3 import ( 4 "context" 5 6 multierror "github.com/hashicorp/go-multierror" 7 "github.com/pkg/errors" 8 ) 9 10 type StackTracer interface { 11 StackTrace() errors.StackTrace 12 } 13 14 // FIXME(skipor): test 15 func Join(err1, err2 error) error { 16 switch { 17 case err1 == nil: 18 return err2 19 case err2 == nil: 20 return err1 21 default: 22 return multierror.Append(err1, err2) 23 } 24 } 25 26 func IsCtxError(ctx context.Context, err error) bool { 27 if err == nil { 28 return true 29 } 30 return ctx.Err() == errors.Cause(err) 31 }