File tree Expand file tree Collapse file tree 3 files changed +390
-6
lines changed Expand file tree Collapse file tree 3 files changed +390
-6
lines changed Original file line number Diff line number Diff line change @@ -104,15 +104,11 @@ func (e *Error) Message() string {
104
104
return strings .Join (messages , ". " )
105
105
}
106
106
107
- return e .message
107
+ return e .Error ()
108
108
}
109
109
110
110
// Unwrap implement's Go 1.13's Unwrap interface exposing the wrapped error
111
111
func (e * Error ) Unwrap () error {
112
- if e .original == nil {
113
- return nil
114
- }
115
-
116
112
return e .original
117
113
}
118
114
Original file line number Diff line number Diff line change @@ -180,6 +180,11 @@ func Benchmark_Internal(b *testing.B) {
180
180
Internal ("hello world" )
181
181
}
182
182
}
183
+ func Benchmark_Internalf (b * testing.B ) {
184
+ for i := 0 ; i < b .N ; i ++ {
185
+ Internalf ("%s prefixed" , "hello world" )
186
+ }
187
+ }
183
188
184
189
func Benchmark_InternalErr (b * testing.B ) {
185
190
err := errors .New ("bad error" )
@@ -251,7 +256,7 @@ func TestError_Message(t *testing.T) {
251
256
eType : TypeInternal ,
252
257
fileLine : "errors.go:87" ,
253
258
},
254
- want : "" ,
259
+ want : "errors.go:87 unknown error occurred " ,
255
260
},
256
261
{
257
262
name : "Nested error with message" ,
You can’t perform that action at this time.
0 commit comments