Control Structures
These are examples of control structures. You may also be interested in:

 Conditional structures
 Exceptions
 Flow-control structures
 Loops

This task is to give an example of an exception handling routine
and to "throw" a new exception.



Related task

   Exceptions Through Nested Calls


/* NetRexx */
options replace format comments java crossref symbols nobinary
 
-- =============================================================================
class RExceptions public
 
  -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  method test() public signals RExceptions.TakeException
    if (1 == 1) then signal RExceptions.TakeException()
    return
 
  -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  method main(args = String[]) public static
    do
      RExceptions().test()
    catch ex = Exception
      say ex.toString()
    end
 
    return;
 
-- =============================================================================
class RExceptions.TakeException public extends Exception
 
  -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  method TakeException() public
    super('I resent that!')
    return
 