Transactions and subscripts


so far I have used the new transaction script steps only without subscripts and I really like how they work. When using a single script, an error makes the script go automatically to the end of the transaction and it is reverted. I do not have to check for errors after each step.

Today I wanted to use a subscript within an open transaction and I am not so happy.
In a subscript I have to report the errors to the calling script, which can then revert the transaction.

Am I right that this means that in subscripts I have to check for errors after each step (and in case of an error exit the script with a result)?

The error handling you get from opening the transaction carries on into the subscript (keep in mind the transaction is bound to the window where it was initiated).

Your subscript can even use the steps to start / end a transaction as a result:

  • if your subscript is called from another script that has not started a transaction, it will start a transaction
  • if a transaction is already ongoing, the steps to handle the transaction will be ignored in the subscript, including the step to revert a transaction.

From my perspective, the main difference & limitation is in how you will handle business logic in subscript to get the transaction to revert just as if your subscript was the one that initiated the transaction.


Thank you very much.
It seems that I did something wrong while testing. It works exactly like you described and the error is automatically handed back to the caller script and it reverts.

And yes, in part I want to revert because of business logic and there I have to report this error back to the caller script.