[next] [previous] [contents]

  16.1 Default Error Handling
  BASIC provides default run-time error handling for all
  programs. If you do not provide your own error handlers,
  the default error handling procedures remain in effect
  throughout program execution time.

  When an error occurs in your program, BASIC diagnoses
  the error and displays a message telling you the nature
  and severity of the error. There are four severity lev-
  els of BASIC errors: SEVERE, ERROR, WARNING, and
  INFORMATIONAL. The severity of an error determines
  whether or not the program aborts if the error occurs when
  default error handling is in effect. When default error
  handling is in effect, ERROR and SEVERE errors always
  terminate program execution, but program execution con-
  tinues when WARNING and INFORMATIONAL errors
  occur.

  To override the default error handling procedures, you can
  provide your own error handlers, as described in the follow-
  ing sections. (Note that you should not call LIB$ESTABLISH
  from a BASIC program as this RTL routine overrides the
  default error handling procedures and may adversely affect
  program behavior.)

  Only one error can be handled at a time. If an error has oc-
  curred but has not yet been handled completely, that error is
  said to be pending . When an error is pending and a second
  error occurs, program execution always terminates imme-
  diately. Therefore, one of the most important functions of an
  error handler is to clear the error so that subsequent errors
  can also be handled.

  If you do not supply your own error handler, program con-
  trol passes to the BASIC error handler when an error occurs.
  For example, when BASIC default error handling is in effect,
  a program will abort when division by zero is attempted be-
  cause division by zero is an error of SEVERE severity. With
  an error handler, you can include an alternative set of in-
  structions for the program to follow; if the zero was input
  at a terminal, a user-written error handler could display a
  ``Try again'' message and execute the program lines again
  requesting input.