github.com/amp-space/amp-sdk-go@v0.7.6/stdlib/errors/errors.go (about) 1 package errors 2 3 import ( 4 "github.com/pkg/errors" 5 ) 6 7 var ( 8 Err403 = errors.New("403: nope") 9 Err404 = errors.New("not found") 10 ErrUnimplemented = errors.New("unimplemented") 11 ErrConnection = errors.New("connection failed") 12 ErrClosed = errors.New("closed") 13 ErrUnsupported = errors.New("unsupported") 14 ) 15 16 var ( 17 New = errors.New 18 Errorf = errors.Errorf 19 Wrap = errors.Wrap 20 Wrapf = errors.Wrapf 21 WithStack = errors.WithStack 22 Cause = errors.Cause 23 ) 24 25 func Annotate(err *error, msg string, args ...interface{}) { 26 if *err != nil { 27 *err = errors.Wrapf(*err, msg, args...) 28 } 29 } 30 31 func AddStack(err *error) { 32 if *err != nil { 33 *err = errors.WithStack(*err) 34 } 35 }