Add Operation with recover
This commit is contained in:
parent
a394e6a3e3
commit
be362f0d9f
11 changed files with 45 additions and 12 deletions
16
safe/routine_test.go
Normal file
16
safe/routine_test.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package safe
|
||||
|
||||
import (
|
||||
"github.com/cenk/backoff"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestOperationWithRecover(t *testing.T) {
|
||||
operation := func() error {
|
||||
panic("BOOM")
|
||||
}
|
||||
err := backoff.Retry(OperationWithRecover(operation), &backoff.StopBackOff{})
|
||||
if err == nil {
|
||||
t.Fatalf("Error in OperationWithRecover: %s", err)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue