异常和错误提示修改
parent
6178eb72a5
commit
6189cec63c
|
@ -27,7 +27,6 @@ public enum ErrorCode implements IErrorCode {
|
||||||
RELOGIN_CODE(-101, "重复登陆"),
|
RELOGIN_CODE(-101, "重复登陆"),
|
||||||
KICK_USER_CODE(-102, "踢用户下线"),
|
KICK_USER_CODE(-102, "踢用户下线"),
|
||||||
|
|
||||||
|
|
||||||
SERVER_SELF_DEFINE(-1, "操作失败"),
|
SERVER_SELF_DEFINE(-1, "操作失败"),
|
||||||
SERVER_DEFINE(-1, "操作失败"),
|
SERVER_DEFINE(-1, "操作失败"),
|
||||||
CFG_NULL(-1, "配置不存在"),
|
CFG_NULL(-1, "配置不存在"),
|
||||||
|
@ -139,18 +138,6 @@ public enum ErrorCode implements IErrorCode {
|
||||||
MAP_IN(105,"在地图探索中,不可以操作"),
|
MAP_IN(105,"在地图探索中,不可以操作"),
|
||||||
HERO_LIVE_AGAIN(106,"英雄{0}秒后复活"),
|
HERO_LIVE_AGAIN(106,"英雄{0}秒后复活"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
private static final Set<Integer> CodeSet = new HashSet<>();
|
private static final Set<Integer> CodeSet = new HashSet<>();
|
||||||
|
|
||||||
|
@ -191,12 +178,7 @@ public enum ErrorCode implements IErrorCode {
|
||||||
return errMsg;
|
return errMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ErrorCode reDefineMsg(String errMsg) {
|
public static String newDefineCode(String errMsg) {
|
||||||
this.errMsg = errMsg;
|
return errMsg;
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ErrorCode newDefineCode(String errMsg) {
|
|
||||||
return SERVER_DEFINE.reDefineMsg(errMsg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,11 @@ public class ErrorCodeException extends Exception {
|
||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ErrorCodeException(String message) {
|
||||||
|
super(message);
|
||||||
|
errorCode = ErrorCode.SERVER_DEFINE;
|
||||||
|
}
|
||||||
|
|
||||||
public ErrorCodeException(ErrorCode errorCode, List<String> params) {
|
public ErrorCodeException(ErrorCode errorCode, List<String> params) {
|
||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.ljsd.jieling.handler;
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessage;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
import com.google.protobuf.Parser;
|
import com.google.protobuf.Parser;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.exception.LogicException;
|
import com.ljsd.jieling.exception.LogicException;
|
||||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
@ -42,7 +44,7 @@ public abstract class BaseHandler<T extends GeneratedMessage> {
|
||||||
} catch(NoSuchFieldException|SecurityException|IllegalAccessException|IllegalArgumentException|ExceptionInInitializerError|InvalidProtocolBufferException var5){
|
} catch(NoSuchFieldException|SecurityException|IllegalAccessException|IllegalArgumentException|ExceptionInInitializerError|InvalidProtocolBufferException var5){
|
||||||
throw new LogicException("解析协议失败",var5);
|
throw new LogicException("解析协议失败",var5);
|
||||||
}catch (Exception var4) {
|
}catch (Exception var4) {
|
||||||
if(null !=proto)
|
if(null !=proto&&!(var4 instanceof ErrorCodeException))
|
||||||
throw new LogicException("processWithProtoException\r\nprotoID:"+netData.getMsgId()+"\r\n"+proto.toString(),var4);
|
throw new LogicException("processWithProtoException\r\nprotoID:"+netData.getMsgId()+"\r\n"+proto.toString(),var4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue