Skip to content

Isolated

Executes the given callback function in an isolated transaction.

1
myScript.Isolated(fn: () => void):void

Parameters

() => void fn
    The callback function to execute.

Remarks

This method is useful when you want to execute some operations in a new transaction without affecting the current transaction result.
The callback function is executed in a new isolated transaction, and operations within the callback are always committed, even if the current transaction is rolled back.
If the callback throws an exception, both the current transaction and the isolated transaction are rolled back.

Example

1
2
3
4
Script.Isolated(function() {
   // Do some operations in a new transaction.
});
throw new Error('some error');