Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit d146efd

Browse files
committed
relocate cause
1 parent 19140ea commit d146efd

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

errors.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,6 @@ func New(text string) error {
7070
}
7171
}
7272

73-
type cause struct {
74-
cause error
75-
message string
76-
}
77-
78-
func (c cause) Error() string { return c.Message() + ": " + c.Cause().Error() }
79-
func (c cause) Cause() error { return c.cause }
80-
func (c cause) Message() string { return c.message }
81-
8273
// Errorf formats according to a format specifier and returns the string
8374
// as a value that satisfies error.
8475
func Errorf(format string, args ...interface{}) error {
@@ -91,6 +82,15 @@ func Errorf(format string, args ...interface{}) error {
9182
}
9283
}
9384

85+
type cause struct {
86+
cause error
87+
message string
88+
}
89+
90+
func (c cause) Error() string { return c.Message() + ": " + c.Cause().Error() }
91+
func (c cause) Cause() error { return c.cause }
92+
func (c cause) Message() string { return c.message }
93+
9494
// Wrap returns an error annotating err with message.
9595
// If err is nil, Wrap returns nil.
9696
func Wrap(err error, message string) error {

0 commit comments

Comments
 (0)