recover.go 208 B

12345678910111213
  1. package rescue
  2. import "github.com/tal-tech/go-zero/core/logx"
  3. func Recover(cleanups ...func()) {
  4. for _, cleanup := range cleanups {
  5. cleanup()
  6. }
  7. if p := recover(); p != nil {
  8. logx.ErrorStack(p)
  9. }
  10. }