Add a Try-Catch Action

You add a Try-Catch action to gracefully handle errors and avoid program crashes.

To use a Try-Catch action:
  1. Add the action in one of three ways, depending on your preference and where you want it added:
    • Drag the action from the Actions palette onto the canvas, dropping the action either at the bottom edge of the action it is to follow, or at the top edge of the action it is to precede.
    • Double-click the action in the Actions palette to add it to an empty canvas or to the end of an action chain.
    • On the canvas, select the action you want the new action to follow, then double-click the new action in the Actions palette.
  2. To change the alias for the error object, which has the name and message properties, select the Catch block on the canvas and change the alias in the Properties pane:

  3. To add an action to a Try-Catch block, select the block and double-click the action in the Actions palette, or drag an action from the Action's palette onto the desired block:

You can also surround an action with a Try-Catch action by right-clicking it and selecting Surround with Try-Catch:
Description of jsac-surround-try-catch.png follows
Description of the illustration jsac-surround-try-catch.png

If you need a Finally block, drag the first action that you want to add to the block over the Try-Catch action and drop it into the Create Finally area that appears:
Description of jsac-create-finally-block.png follows
Description of the illustration jsac-create-finally-block.png