diff --git a/recovery/recovery.go b/recovery/recovery.go index b94d6783..249760ea 100644 --- a/recovery/recovery.go +++ b/recovery/recovery.go @@ -34,7 +34,7 @@ func New(opts ...Option) *Recovery { } } -func (r *Recovery) Wrap(f func() error) error { +func (r *Recovery) Wrap(f func()) { defer func() { if err := recover(); err != nil { if r.opt.handler != nil { @@ -43,5 +43,5 @@ func (r *Recovery) Wrap(f func() error) error { } }() - return f() + f() } diff --git a/recovery/recovery_test.go b/recovery/recovery_test.go index 15e5be48..8869303b 100644 --- a/recovery/recovery_test.go +++ b/recovery/recovery_test.go @@ -7,16 +7,14 @@ import ( ) func TestRecovery_Wrap(t *testing.T) { - fn := func() error { + fn := func() { panic("test") - - return nil } // default r := New() assert.Panics(t, func() { - _ = r.Wrap(fn) + r.Wrap(fn) }) // with handler @@ -24,5 +22,7 @@ func TestRecovery_Wrap(t *testing.T) { assert.Equal(t, "test", err) })) - assert.NoError(t, r.Wrap(fn)) + assert.NotPanics(t, func() { + r.Wrap(fn) + }) }