Browse Source

RecoverPanic fixed

pull/90/head
yedf2 4 years ago
parent
commit
0941c171ef
  1. 2
      common/utils.go
  2. 2
      common/utils_test.go

2
common/utils.go

@ -90,7 +90,7 @@ func RecoverPanic(err *error) {
if x := recover(); x != nil {
e := dtmimp.AsError(x)
if err != nil {
err = &e
*err = e
}
}
}

2
common/utils_test.go

@ -49,7 +49,7 @@ func TestFuncs(t *testing.T) {
func TestRecoverPanic(t *testing.T) {
err := func() (rerr error) {
RecoverPanic(&rerr)
defer RecoverPanic(&rerr)
panic(fmt.Errorf("an error"))
}()
assert.Equal(t, "an error", err.Error())

Loading…
Cancel
Save