Skip to content

Commit

Permalink
Add more log for simulation error
Browse files Browse the repository at this point in the history
  • Loading branch information
tupui committed May 2, 2024
1 parent da45390 commit e0d2ae9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/soroban/invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import stellar_sdk
from stellar_sdk import xdr
from stellar_sdk.exceptions import SdkError
from stellar_sdk.exceptions import PrepareTransactionException, SdkError
from stellar_sdk.soroban_rpc import GetTransactionStatus, SendTransactionStatus

import soroban.models as soroban_models
Expand Down Expand Up @@ -63,7 +63,13 @@ def invoke(
)
.build()
)
tx = soroban_server.prepare_transaction(tx)

try:
tx = soroban_server.prepare_transaction(tx)
except PrepareTransactionException as err:
err_msg = err.simulate_transaction_response.error
raise SdkError(f"Failed to simulate transaction: {err_msg}")

tx.sign(identity.keypair)
transaction = soroban_server.send_transaction(tx)

Expand Down

0 comments on commit e0d2ae9

Please sign in to comment.