catch catch-name catch-parameter-list
You can use
catch to mark the point in your program where execution will resume following
catch has a name, so you can have multiple active
with different names. Each
throw must name the
catch it throws to. A
clause introduces a block of code which is executed once the
throw is caught.
catch is active only when it is in the current execution scope of your program. OmniMark will
look for the
catch named in a
throw in the current scope. If the named
does not exist in the current scope, OmniMark looks for it in the parent scope, and so on. Once the
catchis found, OmniMark closes the current scope and all intervening scopes as required to reach
catch. Execution is then transferred to the block of code following the
If the named
catch is not found, OmniMark raises an error which will be caught by the first
It is a compile-time error to use a
catch that has not been declared.
catch the same
catch name at different points in your program, but there can
be only one
catch of a particular
catch name in any one lexical scope. Only
catch in the innermost execution scope is active at any given point in program execution.
Many OmniMark constructs can result in a rule or function being called recursively. Therefore, a
catch clause may exist at many different levels of execution scope when a program is run.
catch clauses are always at the end of a scope. That is to say, a
catch clause is
outside the normal flow of that scope. Execution does not fall through into a
catch clause. The code in
catch clause can only be executed as a result of a
throw initiated inside a
catch clause or an
always clause cannot be caught in the same local scope.
always clause must be caught at a wider scope of execution.