Skip to content

Commit 30378f3

Browse files
authored
Better exception handling
1 parent 74feb00 commit 30378f3

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎src/main/java/org/tron/core/net/message/TronMessageFactory.java‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ public TronMessage create(byte[] data) throws Exception {
1515
byte type = data[0];
1616
byte[] rawData = ArrayUtils.subarray(data, 1, data.length);
1717
return create(type, rawData);
18-
} catch (Exception e) {
19-
if (e instanceof P2pException) {
20-
throw e;
21-
} else {
22-
throw new P2pException(P2pException.TypeEnum.PARSE_MESSAGE_FAILED,
23-
"type=" + data[0] + ", len=" + data.length);
24-
}
18+
} catch (final P2pException e) {
19+
throw e;
20+
} catch (final Exception e) {
21+
throw new P2pException(P2pException.TypeEnum.PARSE_MESSAGE_FAILED,
22+
"type=" + data[0] + ", len=" + data.length);
2523
}
2624
}
2725

0 commit comments

Comments
 (0)