Syntax:
errorInfo% = error
Description:
This function returns information about the most recent disk i/o error encountered in your program. It relates only to i/o errors in the FutureBasic runtime; it does not include string errors, numeric errors, or error codes returned by MacOS Toolbox functions.
The error function returns a 2-byte integer. The low-order byte contains an error code. Usually, the error involves some file operation; when this is the case, the high-order byte contains the file ID number of the relevant file. You can retrieve both of these pieces of information as follows:
errorCode% = error and &FF
fileID% = error >> 8
errorCode% will be set to one of the following values:
_noErr (0)
_endOfFile (1)
_diskFull (2)
_fileNotFound (3)
_fileNotOpen (4)
_badFileName (5)
_badFileNum (6)
_writeOnly (7)
_readOnly (8)
_posErr (9)
_diskErr (10)
_systemErr (11)
_openTypeErr (12)
Note that these kinds of errors will normally cause your program to stop executing. If you want to trap and handle these errors within your program, you must use the on error fn and on error end statements.
Note:
After retrieving the error information with the error function, you should reset FutureBasic's internal error register by executing the error = _noErr statement.
See Also:
error statement; on error fn; on error gosub