fixed error handle

This commit is contained in:
free will committed 2021-03-24 11:22:23 +08:00
1 parent 7bf0906291
commit adf834a4e9
10 files changed
+31 -67

No files matched your search

+5 -13
View File
@@ -61,7 +61,7 @@ public class CPacket implements InteractWithField, IEncodingAble {
Block block= null;
try {
block = new SelfEncodingBase().selfWireEncode(this.ttl);
} catch (EncoderException | BlockException e) {
} catch (EncoderException | BlockException | ComponentException e) {
throw new PacketException("CPacket.fillDataToFields: "+e.getMessage());
}
if(block==null){
@@ -74,7 +74,7 @@ public class CPacket implements InteractWithField, IEncodingAble {
this.minPacket.readOnlyField.clearBlocks();
try {
block=new SelfEncodingBase().selfWireEncode(this.payload);
} catch (EncoderException | BlockException e) {
} catch (EncoderException | BlockException | ComponentException e) {
throw new PacketException("CPacket.fillDataToFields: "+e.getMessage());
}
if(block==null){
@@ -151,11 +151,7 @@ public class CPacket implements InteractWithField, IEncodingAble {
// 指定包类型
this.minPacket.packetType=new VlInt(TLV.TlvPacketMINCommon);
try {
return this.minPacket.wireEncode(encoder);
} catch (EncoderException e) {
throw new PacketException("CPacket.wireEncode: "+e.getMessage());
}
return this.minPacket.wireEncode(encoder);
}
/**
@@ -165,12 +161,8 @@ public class CPacket implements InteractWithField, IEncodingAble {
*/
@Override
public boolean wireDecode(Block block) throws PacketException {
try {
if(!this.minPacket.wireDecode(block)){
return false;
}
} catch (VlIntException e) {
throw new PacketException("CPacket.wireDecode: "+e.getMessage());
if(!this.minPacket.wireDecode(block)){
return false;
}
return this.extraDataFromFields();
}