panic if err is nil on c.Error
A panic here provides a more informative stack trace than the panic which would otherwise occur while errors are being collected.
This commit is contained in:
@ -852,6 +852,13 @@ func TestContextError(t *testing.T) {
|
||||
assert.Equal(t, c.Errors[1].Type, ErrorTypePublic)
|
||||
|
||||
assert.Equal(t, c.Errors.Last(), c.Errors[1])
|
||||
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Error("didn't panic")
|
||||
}
|
||||
}()
|
||||
c.Error(nil)
|
||||
}
|
||||
|
||||
func TestContextTypedError(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user