2020-07-26 17:09:05 +08:00
|
|
|
package rescue
|
|
|
|
|
2020-08-08 16:40:10 +08:00
|
|
|
import "github.com/tal-tech/go-zero/core/logx"
|
2020-07-26 17:09:05 +08:00
|
|
|
|
|
|
|
func Recover(cleanups ...func()) {
|
|
|
|
for _, cleanup := range cleanups {
|
|
|
|
cleanup()
|
|
|
|
}
|
|
|
|
|
|
|
|
if p := recover(); p != nil {
|
|
|
|
logx.ErrorStack(p)
|
|
|
|
}
|
|
|
|
}
|