Library /sys$common/syshlp/TPUHELP.HLB  —  ERROR_HANDLERS
  Error Handlers

  An error handler is a block of code containing statements to be executed
  if DECTPU generates a warning or an error.  Error handlers are optional
  and may be used either in procedures or in programs.  When used in
  programs (outside procedures) they must be placed after all the global
  declarations of constants, variables and procedures, and before any
  executable statements.  Only one error handler can be used in each
  procedure, and only one one can be used per program (outside procedures).

  DECTPU error handlers are not usually recursive; that is, they do not
  apply their own statements to errors that arise while the error handler
  itself is being executed.  However, CTRL/C routines are an exception; they
  ARE recursive.

  Types of Error Handlers in DECTPU

  DECTPU has two types of error handlers:  procedure-style and case-style.

  The following example shows the syntax of a procedure-style error handler:

     ON_ERROR
       MESSAGE (ERROR_TEXT);
       MESSAGE ("Error on line " + STR (ERROR_LINE));
       RETURN;
     ENDON_ERROR

  The following example shows the syntax of a case-style error handler:

     ON_ERROR
         [TPU$_CONTROLC]:
            MESSAGE (ERROR_TEXT);
            RETURN (LEARN_ABORT);
         [OTHERWISE]:
            MESSAGE( ERROR_TEXT);
            RETURN;
     ENDON_ERROR

  Case-style error handlers are similar to DECTPU case statements.  The
  statements in the handler have the general format:

     [error-keyword1,...error-keywordn] :  statement1;...statementn;

  The the selectors on the left-hand side of the colon in each statement
  must be either of the following:

  o  DECTPU keywords indentifying errors or warnings

  o  The keyword OTHERWISE

  Case-style error handlers allow you to do the following:

  o  Trap the TPU$_CONTROLC status

  o  Specify an [OTHERWISE] selector specifying how to handle all errors and
     warnings that are not covered by specific selectors in the error
     handler.

  o  Suppress display of error and warning messages

  For more information on using error handlers, please refer to the DEC Text
  Processing Utility Manual.

  Related Topics

     CALL_USER   ERROR   ERROR_LINE   ERROR_TEXT     LEARN_ABORT

     MESSAGE    MESSAGE_FLAGS       MESSAGE_TEXT   RETURN
Close Help