添加世界运行异常时的堆栈打印

This commit is contained in:
walker 2023-10-19 13:12:45 +08:00
parent 37e06d2aaf
commit 0eb750b76a

View File

@ -4,6 +4,7 @@ import (
"fmt"
"log/slog"
"math"
"runtime/debug"
"time"
"github.com/yohamta/donburi"
@ -219,6 +220,8 @@ func (w *world) run() {
defer func() {
if err := recover(); err != nil {
w.exception(err)
slog.Error("世界运行异常", "error", err, "stack", string(debug.Stack()))
debug.PrintStack()
}
}()
for range w.ticker.C {