From 3351e00d675cf63865cf71fef97bf46904205aac Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 10 Jan 2024 10:00:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/buried/api_info.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/buried/api_info.go b/modules/buried/api_info.go index 02dfa0060..3b4b7a4cc 100644 --- a/modules/buried/api_info.go +++ b/modules/buried/api_info.go @@ -38,6 +38,10 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.BuriedInfoReq) (err for _, items := range buried.Items { for _, v := range items.Condi { if conf, err = this.module.configure.getburiedcondidata(v.Conid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } return } conditions = append(conditions, comm.GetBuriedConIProgress(conf, v)) From 1f1dce7e23d4a8c9c82d8a3a3672359e5a6bb1d2 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 10 Jan 2024 10:05:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=BC=82=E5=B8=B8=E6=8D=95=E6=8D=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/modulebase.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/modulebase.go b/modules/modulebase.go index 38a65dbf9..bf873b522 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -7,6 +7,7 @@ import ( "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" "go_dreamfactory/lego/core/cbase" + "runtime" "time" "go_dreamfactory/lego/sys/log" @@ -983,6 +984,14 @@ func (this *ModuleBase) FormatRes(res []*cfg.Gameatn) (ret []*cfg.Gameatn) { //异步调用用户处理流 func (this *ModuleBase) AsynHandleSession(session comm.IUserSession, handle func(session comm.IUserSession)) { + defer func() { //程序异常 收集异常信息传递给前端显示 + if r := recover(); r != nil { + buf := make([]byte, 4096) + l := runtime.Stack(buf, false) + err := fmt.Errorf("%v: %s", r, buf[:l]) + log.Errorf("[AsynHandleSession] err:%s", err.Error()) + } + }() handle(session) session.Push() this.PutUserSession(session)