mirror of
https://github.com/pkg/errors.git
synced 2025-05-31 11:42:45 +00:00
relocate cause
This commit is contained in:
parent
19140ea8c4
commit
d146efd52a
18
errors.go
18
errors.go
@ -70,15 +70,6 @@ func New(text string) error {
|
||||
}
|
||||
}
|
||||
|
||||
type cause struct {
|
||||
cause error
|
||||
message string
|
||||
}
|
||||
|
||||
func (c cause) Error() string { return c.Message() + ": " + c.Cause().Error() }
|
||||
func (c cause) Cause() error { return c.cause }
|
||||
func (c cause) Message() string { return c.message }
|
||||
|
||||
// Errorf formats according to a format specifier and returns the string
|
||||
// as a value that satisfies error.
|
||||
func Errorf(format string, args ...interface{}) error {
|
||||
@ -91,6 +82,15 @@ func Errorf(format string, args ...interface{}) error {
|
||||
}
|
||||
}
|
||||
|
||||
type cause struct {
|
||||
cause error
|
||||
message string
|
||||
}
|
||||
|
||||
func (c cause) Error() string { return c.Message() + ": " + c.Cause().Error() }
|
||||
func (c cause) Cause() error { return c.cause }
|
||||
func (c cause) Message() string { return c.message }
|
||||
|
||||
// Wrap returns an error annotating err with message.
|
||||
// If err is nil, Wrap returns nil.
|
||||
func Wrap(err error, message string) error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user