1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-05 23:44:07 +08:00
parent 30c89dcd2a
commit a0d4567d3f
10 changed files with 110 additions and 47 deletions

View File

@@ -105,8 +105,15 @@ func (s *Server) OnTraffic(c gnet.Conn) (action gnet.Action) {
defer func() {
if err := recover(); err != nil { // 恢复 panicerr 为 panic 错误值
// 1. 打印错误信息
if t, ok := c.Context().(*player.ClientData); ok {
if t.Player != nil {
if t.Player.Info != nil {
cool.Logger.Error(context.TODO(), "panic 错误:", t.Player.Info.UserID, err)
}
cool.Logger.Error(context.TODO(), "panic 错误:", err)
}
}
}
}()