is thrown

operator

Return type:
Switch
Returns:
Returns true if the named throw has been thrown but has not yet been caught, and false otherwise. Replacing is with isnt will reverse the results.
Syntax
named-throw (is | isnt) thrown


Purpose

You can use the is thrown test to determine if a throw is in progress to the catch name specified.

The catch name specified can be any of the following:

  • a programmer-defined catch
  • #program-error
  • #external-exception

A compile-time error is produced if the programmer-defined catch name is not declared within the program.

Because OmniMark allows multiple throws at the same time, you may not want to produce an additional throw while another throw is being processed. Using is thrown can avoid having multiple throws caused by the same error condition.

Actions in an always clause are always executed at the end of a local scope, whether a throw is in progress or not. A throw within an always can leave you with two throws active at once. If this is inappropriate, you can test as follows:

  do 
     submit file foo
     always
     do when count > 5000
        throw bar unless #external-exception is thrown 
     done
  done

Related Concepts