Skip to content

Commit

Permalink
fix: 修正JS引擎崩溃时,错误的代码导致JS Panic未能成功捕获的问题 (#1174)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaienNate authored Dec 29, 2024
1 parent 563e122 commit f08f1ba
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dice/dice_jsvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,11 @@ func (d *Dice) JsInit() {
_, _ = vm.RunString(`Object.freeze(seal);Object.freeze(seal.deck);Object.freeze(seal.coc);Object.freeze(seal.ext);Object.freeze(seal.vars);`)
})
go func() {
if r := recover(); r != nil {
log.Errorf("JS核心执行异常: %v 堆栈: %v", r, string(debug.Stack()))
}
defer func() {
if r := recover(); r != nil {
log.Errorf("JS核心执行异常: %v 堆栈: %v", r, string(debug.Stack()))
}
}()
loop.StartInForeground()
}()
// loop.Start()
Expand Down

0 comments on commit f08f1ba

Please sign in to comment.