From f0a56ea6722b620c8b900efa9f0d626f00af00ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?walker-sheng=E2=80=9D?= Date: Mon, 10 Jun 2024 19:25:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E8=AE=B0=E5=BD=95=E8=B5=8B?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- world.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/world.go b/world.go index 230e3d6..54e0fee 100644 --- a/world.go +++ b/world.go @@ -77,6 +77,9 @@ type world struct { cancel context.CancelFunc done chan struct{} // 服务协程退出信号 + + // 世界异常记录 + err any } // 新建一个组件类型 @@ -279,11 +282,11 @@ func (w *world) run(ctx context.Context) { // 世界运行异常处理 func (w *world) exception(err any) { - // slog.Error("世界运行异常", "error", err, "stack", string(debug.Stack())) + w.err = err + // 世界异常 w.updateState(WorldError) // 关闭定时器 w.ticker.Stop() - // w.handleRequestAndEvent() } // 世界正常关闭逻辑