diff --git a/goutils/proto_build/tpls/logic_grpc_struct.tpl b/goutils/proto_build/tpls/logic_grpc_struct.tpl index 408c23f..41591ae 100644 --- a/goutils/proto_build/tpls/logic_grpc_struct.tpl +++ b/goutils/proto_build/tpls/logic_grpc_struct.tpl @@ -7,6 +7,7 @@ import ( "fmt" "fusen-basic/env" + "fusen-basic/utils/log" "{{.ProjectName}}/gen/go/service" "{{.ProjectName}}/server/config" @@ -53,6 +54,7 @@ func (lgrpc *{{.StructName}}Grpc) {{.MethodName}}({{range $index, $param := .Par if _recoverErr := recover(); _recoverErr != nil { _resp = nil _err = fmt.Errorf("%v", _recoverErr) + log.Printf("recovered from panic: %v\n%s", _err, string(debug.Stack())) } }() return New{{.StructName}}(ctx).{{.MethodName}}Logic({{range $index, $param := .ParamsName}}{{if $index}}, {{end}}{{$param}}{{end}}) @@ -64,6 +66,7 @@ func (lgrpc *{{.StructName}}Grpc) {{.MethodName}}(stream {{range $index, $param defer func() { if _recoverErr := recover(); _recoverErr != nil { _err = fmt.Errorf("%v", _recoverErr) + log.Printf("recovered from panic: %v\n%s", _err, string(debug.Stack())) } }() return New{{.StructName}}(stream.Context()).{{.MethodName}}Logic(stream)