File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616
1717public abstract class MessageFactory {
1818
19- public static String ERR_NO_SUCH_MSG = "No such message" ;
20- public static String ERR_PARSE_FAILED = "parse message failed" ;
21-
2219 protected abstract Message create (byte [] data ) throws Exception ;
2320
2421}
Original file line number Diff line number Diff line change @@ -19,13 +19,9 @@ public TransactionsMessage(List<Transaction> trxs) {
1919 }
2020
2121 public TransactionsMessage (byte [] data ) throws Exception {
22- try {
23- this .type = MessageTypes .TRXS .asByte ();
24- this .data = data ;
25- this .transactions = Protocol .Transactions .parseFrom (data );
26- }catch (Exception e ){
27- throw new P2pException (P2pException .TypeEnum .PARSE_MESSAGE_FAILED );
28- }
22+ this .type = MessageTypes .TRXS .asByte ();
23+ this .data = data ;
24+ this .transactions = Protocol .Transactions .parseFrom (data );
2925 }
3026
3127 public Protocol .Transactions getTransactions () {
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public TronMessage create(byte[] data) throws Exception{
2727 private TronMessage create (byte type , byte [] packed ) throws Exception {
2828 MessageTypes receivedTypes = MessageTypes .fromByte (type );
2929 if (receivedTypes == null ){
30- throw new RuntimeException ( MessageFactory . ERR_NO_SUCH_MSG + ", type=" + type );
30+ throw new P2pException ( P2pException . TypeEnum . NO_SUCH_MESSAGE , " type=" + type );
3131 }
3232 switch (receivedTypes ) {
3333 case TRX :
You can’t perform that action at this time.
0 commit comments