封装的方法类

This commit is contained in:
Yun
2023-09-16 20:14:20 +08:00
commit 1bbc7db405
59 changed files with 3671 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package panicx
import (
// "errors"
// "bop_notify/global"
"errors"
"fmt"
"log"
// "os"
"runtime/debug"
// "time"
)
func PanicCatch(a *error) (b bool) {
// *a = errors.New("fff")
errs := recover()
// fmt.Printf("这是全局捕捉的 %T \n", errs)
if errs == nil {
return true
}
fmt.Println("Recover Error:", errs)
log.Println("errMsg", errs)
log.Println("errStack", string(debug.Stack()))
*a = errors.New("recover捕捉到异常")
return false
}