Skip to content

ThrowIfCancelled

Throws an error if the current transaction is canceled.

1
myScript.ThrowIfCancelled():void

Remarks

This method is useful when you want to check the current transaction is canceled and abort the current operation.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
function longRunningMethod() {

  var isCompleted = false;

  while(!isCompleted) {

    isCompleted = SomethingRunningLongTime();

    // break if cancelled
    Script.ThrowIfCancelled();

  }

}