Skip to content

Commit e0d2ae9

Browse files
committed
Add more log for simulation error
1 parent da45390 commit e0d2ae9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/soroban/invoke.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import stellar_sdk
55
from stellar_sdk import xdr
6-
from stellar_sdk.exceptions import SdkError
6+
from stellar_sdk.exceptions import PrepareTransactionException, SdkError
77
from stellar_sdk.soroban_rpc import GetTransactionStatus, SendTransactionStatus
88

99
import soroban.models as soroban_models
@@ -63,7 +63,13 @@ def invoke(
6363
)
6464
.build()
6565
)
66-
tx = soroban_server.prepare_transaction(tx)
66+
67+
try:
68+
tx = soroban_server.prepare_transaction(tx)
69+
except PrepareTransactionException as err:
70+
err_msg = err.simulate_transaction_response.error
71+
raise SdkError(f"Failed to simulate transaction: {err_msg}")
72+
6773
tx.sign(identity.keypair)
6874
transaction = soroban_server.send_transaction(tx)
6975

0 commit comments

Comments
 (0)