ON ERROR GOTO [branchLabel]

When an error occurs, the special variables Err and Err$ hold numeric and string values describing what sort of error happened. Some kinds of errors do not have a numeric value, in which case Err will be zero.

If an error occurs in a user function or subroutine, Just BASIC will exit the current function or subroutine and continue to exit functions and subroutines until it finds ON ERROR handler.

Here is a short list of error codes:

  3	RETURN without GOSUB
  4	Read past end of data
  8	Branch label not found
  9	Subscript out of range
  11	Division by zero
  53	OS Error: The system cannot find the file specified.
  58	OS Error: Cannot create a file when that file already exists.
  55	Error opening file
  52	Bad file handle
  62	Input past end of file

