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, as explained at the end of Built-In Actions.
  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