catch Production

Definition

catch : catch ( ref ) inner_stm
      | catch ( ref identifier ) inner_stm
      | catch ( exception ) inner_stm
      | catch ( exception identifier ) inner_stm


Purpose

A catch defines an exception handler for the exception named ref, or for all exceptions. Exception handlers may take the exception as an argument if the exception has metadata. Handlers handling exception are a generic handler called a "catch-all" statement. They handle all exceptions. A catch all may take the exception as an argument, or they may simply execute.

Semantics

If an exception has no body, its handler must not take an argument.

Catchall handlers must come at the end of the list.