Previous Next Edit Rename Undo Refresh Search Administration
SUB Function ( ... )
This instruction indicates the beginning of the error management part of a function or a procedure.
The catch part is executed when an error is raised between the beginning of the function execution and its end. This error can be raised by the function itself, or by any other function called during its execution, provided that this deeper function has no catch part itself: the deeper the catch part is, the more priority it has.
If an error is raised during the execution of the catch part, it is normally propagated. The catch part does not protect itself!
If there is a finally part in the function, it must precede the catch part. See FINALLY
for more details.
' Prints a file to the screen
SUB PrintFile(FileName AS STRING)
DIM hFile AS File
DIM sLig AS STRING
OPEN FileName FOR READ AS #hFile
WHILE NOT EOF(hFile)
LINE INPUT #hFile, sLig
FINALLY ' Always executed, even if a error is raised
CATCH ' Executed only if there is an error
PRINT "Cannot print file "; FileName