From b84e31c5fca3748c6a2479f5ae80af97fde5bcdd Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 20 Feb 2024 10:56:03 +0200 Subject: [PATCH] add try-finally statement --- multiversx_sdk_cli/cli_transactions.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/multiversx_sdk_cli/cli_transactions.py b/multiversx_sdk_cli/cli_transactions.py index 5c89e389..5e02cac1 100644 --- a/multiversx_sdk_cli/cli_transactions.py +++ b/multiversx_sdk_cli/cli_transactions.py @@ -88,11 +88,12 @@ def send_transaction(args: Any): output = CLIOutputBuilder() proxy = CustomNetworkProvider(args.proxy) - tx_hash = proxy.send_transaction(tx) - output.set_emitted_transaction_hash(tx_hash) - - output = output.set_emitted_transaction(tx).build() - utils.dump_out_json(output, outfile=args.outfile) + try: + tx_hash = proxy.send_transaction(tx) + output.set_emitted_transaction_hash(tx_hash) + finally: + output = output.set_emitted_transaction(tx).build() + utils.dump_out_json(output, outfile=args.outfile) def get_transaction(args: Any):