Skip to content

Commit 5965016

Browse files
committed
print exception msg
1 parent 7278761 commit 5965016

File tree

1 file changed

+9
-5
lines changed
  • src/main/java/org/tron/common/runtime/vm/program

1 file changed

+9
-5
lines changed

src/main/java/org/tron/common/runtime/vm/program/Program.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ private void createContractImpl(DataWord value, byte[] programCode, byte[] newAd
516516
TransferActuator.validateForSmartContract(deposit, senderAddress, newAddress, endowment);
517517
} catch (ContractValidateException e) {
518518
// TODO: unreachable exception
519-
throw new BytecodeExecutionException(VALIDATE_FOR_SMART_CONTRACT_FAILURE);
519+
throw new BytecodeExecutionException(VALIDATE_FOR_SMART_CONTRACT_FAILURE, e.getMessage());
520520
}
521521
deposit.addBalance(senderAddress, -endowment);
522522
newBalance = deposit.addBalance(newAddress, endowment);
@@ -710,7 +710,7 @@ public void callToAddress(MessageCall msg) {
710710
refundEnergy(msg.getEnergy().longValue(), "refund energy from message call");
711711
throw new TransferException("transfer trx failed: %s", e.getMessage());
712712
}
713-
throw new BytecodeExecutionException(VALIDATE_FOR_SMART_CONTRACT_FAILURE);
713+
throw new BytecodeExecutionException(VALIDATE_FOR_SMART_CONTRACT_FAILURE, e.getMessage());
714714
}
715715
deposit.addBalance(senderAddress, -endowment);
716716
contextBalance = deposit.addBalance(contextAddress, endowment);
@@ -723,7 +723,7 @@ public void callToAddress(MessageCall msg) {
723723
refundEnergy(msg.getEnergy().longValue(), "refund energy from message call");
724724
throw new TransferException("transfer trc10 failed: %s", e.getMessage());
725725
}
726-
throw new BytecodeExecutionException(VALIDATE_FOR_SMART_CONTRACT_FAILURE);
726+
throw new BytecodeExecutionException(VALIDATE_FOR_SMART_CONTRACT_FAILURE, e.getMessage());
727727
}
728728
deposit.addTokenBalance(senderAddress, tokenId, -endowment);
729729
deposit.addTokenBalance(contextAddress, tokenId, endowment);
@@ -1414,7 +1414,7 @@ public void callToPrecompiledAddress(MessageCall msg,
14141414
&& senderAddress != contextAddress && msg.getEndowment().value().longValueExact() > 0) {
14151415
if (!isTokenTransfer) {
14161416
try {
1417-
transfer(deposit, senderAddress, contextAddress,
1417+
tranzsfer(deposit, senderAddress, contextAddress,
14181418
msg.getEndowment().value().longValueExact());
14191419
} catch (ContractValidateException e) {
14201420
throw new BytecodeExecutionException("transfer failure");
@@ -1424,7 +1424,7 @@ public void callToPrecompiledAddress(MessageCall msg,
14241424
TransferAssetActuator
14251425
.validateForSmartContract(deposit, senderAddress, contextAddress, tokenId, endowment);
14261426
} catch (ContractValidateException e) {
1427-
throw new BytecodeExecutionException(VALIDATE_FOR_SMART_CONTRACT_FAILURE);
1427+
throw new BytecodeExecutionException(VALIDATE_FOR_SMART_CONTRACT_FAILURE, e.getMessage());
14281428
}
14291429
deposit.addTokenBalance(senderAddress, tokenId, -endowment);
14301430
deposit.addTokenBalance(contextAddress, tokenId, endowment);
@@ -1558,6 +1558,10 @@ public static class BytecodeExecutionException extends RuntimeException {
15581558
public BytecodeExecutionException(String message) {
15591559
super(message);
15601560
}
1561+
1562+
public BytecodeExecutionException(String message, Object... args) {
1563+
super(format(message, args));
1564+
}
15611565
}
15621566

15631567
public static class TransferException extends BytecodeExecutionException {

0 commit comments

Comments
 (0)