refactor(error): 重构错误处理机制,使用ErrorCode枚举替代OutInfo接口

This commit is contained in:
1
2025-07-31 07:31:25 +00:00
parent 3bbc786520
commit a53ecc4fa9
9 changed files with 31 additions and 60 deletions

View File

@@ -2,6 +2,7 @@ package controller
import (
"blazing/common/data/entity"
"blazing/common/socket/errorcode"
"blazing/common/socket/handler"
"blazing/cool"
"blazing/logic/service"
@@ -208,13 +209,13 @@ func Recv(c *entity.Conn, data handler.TomeeHeader) {
return
}
aa, ok := ret[1].Interface().(service.OutInfo) //判断错误
aa, ok := ret[1].Interface().(errorcode.ErrorCode) //判断错误
if ok && aa != nil { //这里实现回复错误包
if ok && aa != 0 { //这里实现回复错误包
cool.Loger.Error(context.Background(), aa.Error(), aa.Code())
cool.Loger.Error(context.Background(), aa.Code())
data.Result = uint32(aa.Code())
data.Result = uint32(aa)
c.SendPack(data.Pack(nil))
return