84 lines
3.0 KiB
Go
84 lines
3.0 KiB
Go
package proto
|
|
|
|
import "fmt"
|
|
|
|
type ErrorCode int
|
|
|
|
const (
|
|
Ok ErrorCode = 0 // ok
|
|
Fail ErrorCode = 1 // 失败
|
|
Internal ErrorCode = 2 // 内部错误
|
|
NotEnough ErrorCode = 3 // 不足
|
|
RoomFull ErrorCode = 4 // 房间已满
|
|
BadParam ErrorCode = 5 // 参数错误
|
|
Matching ErrorCode = 6 // 匹配中
|
|
NotCurrent ErrorCode = 7 // 不是当前行动人
|
|
BadAction ErrorCode = 8 // 错误行为
|
|
TakeCoinNotEnough ErrorCode = 9 // 携带金币不足
|
|
Maintain ErrorCode = 10 // 服务维护中
|
|
NotOpenGm ErrorCode = 11 // 没有开启gm指令
|
|
NotExistRoom ErrorCode = 12 // 房间不存在
|
|
RoomCoinLimit ErrorCode = 13 // 超出房间金币限制
|
|
InRoom ErrorCode = 14 // 已经在房间中
|
|
DisbandRoom ErrorCode = 15 // 管理员解散房间
|
|
AccountLocked ErrorCode = 16 // 封号
|
|
CutLineZero ErrorCode = 17 // 插队次数已用完
|
|
UserClubScoreNotEnough ErrorCode = 18 // 用户俱乐部积分不足
|
|
NotInClub ErrorCode = 19 // 不在该俱乐部
|
|
NotClubPlayGame ErrorCode = 20 // 俱乐部没有创建玩法或者没有开启该玩法
|
|
NotClubMgr ErrorCode = 21 // 不是该俱乐部管理员
|
|
ClubCoinNotEnough ErrorCode = 22 // 俱乐部币不足
|
|
ExistClubPlayGame ErrorCode = 23 // 俱乐部已存在该玩法
|
|
ClubNotOpen ErrorCode = 24 // 俱乐部已关闭
|
|
ClubNotExist ErrorCode = 25 // 俱乐部不存在
|
|
NotDisbandRoom ErrorCode = 26 // 无法解散房间
|
|
SubsidyNotEnough ErrorCode = 27 // 剩余破产补贴领取次数不足
|
|
NotSetDarkPoker ErrorCode = 28 // 不能设置暗牌
|
|
CodeIsExist ErrorCode = 29 // 兑换码已存在
|
|
CodeIsInValid ErrorCode = 30 // 兑换码不存在已失效或使用失败
|
|
CodeIsUsed ErrorCode = 31 // 兑换码已被使用
|
|
GameStarted ErrorCode = 32 // 游戏已开始
|
|
)
|
|
|
|
func (e ErrorCode) Error() error {
|
|
switch e {
|
|
case Ok:
|
|
return fmt.Errorf("ok")
|
|
case Fail:
|
|
return fmt.Errorf("fail")
|
|
case Internal:
|
|
return fmt.Errorf("internal error")
|
|
case NotEnough:
|
|
return fmt.Errorf("not enough")
|
|
case RoomFull:
|
|
return fmt.Errorf("room full")
|
|
case BadParam:
|
|
return fmt.Errorf("bad parameter")
|
|
case Matching:
|
|
return fmt.Errorf("matching")
|
|
case NotCurrent:
|
|
return fmt.Errorf("not current")
|
|
case BadAction:
|
|
return fmt.Errorf("bad action")
|
|
case TakeCoinNotEnough:
|
|
return fmt.Errorf("take coin not enough")
|
|
case Maintain:
|
|
return fmt.Errorf("maintain")
|
|
case NotOpenGm:
|
|
return fmt.Errorf("not open gm")
|
|
case NotExistRoom:
|
|
return fmt.Errorf("not exist room")
|
|
case RoomCoinLimit:
|
|
return fmt.Errorf("room coin limit")
|
|
case InRoom:
|
|
return fmt.Errorf("in room")
|
|
case DisbandRoom:
|
|
return fmt.Errorf("disband room")
|
|
case AccountLocked:
|
|
return fmt.Errorf("account locked")
|
|
case SubsidyNotEnough:
|
|
return fmt.Errorf("subsidy not enough")
|
|
}
|
|
return nil
|
|
}
|