Futurebasic/Language/Reference/on error end

ON ERROR ENDEdit

StatementEdit

(+) Appearance (+) Standard Console

Syntax:

ON ERROR END

RevisedEdit

June, 2001 (Release 5)

DescriptionEdit

There are two possible outcomes when using this statement and they depend on other factors in your program. If you have not established any other error handling routine, then you may use this routine to turn off all error checking. Errors such as file errors will be ignored. It will be your responsibility to track them manually after each file access statement by checking the function ERROR. This concept is demonstrated in the example below.

A second use involves programs where you have set up your own error handling routines. You may toggle between FB's error handling and your program's built-in error handlers by using ON ERROR END to turn off FB's handlers and use the ones in your program. Alternatively, you may use ON ERROR RETURN to reinstate FB's handlers.

Example:

<code>// Manual, line-by-line error handling</code>

<code><b>PRINT</b> "This program will produce a file error"<br>
<b>PRINT</b> "that is completely ignored."</code>

<code><b>ON ERROR END</b><br>
<b>OPEN</b> "I",#1,"this file does not exist"</code>

<code><b>PRINT</b><br>
<b>PRINT</b> "The error has occurred and was not flagged."</code>

<code><b>PRINT</b> "The error number is"; <b>ERROR AND</b> &FF<br>
<b>PRINT</b> "In file number"; <b>ERROR</b> >> 8<br>
<b>PRINT</b> "The system error is"; <b>SYSERROR</b></code>

Note:
If you turn off error checking (ON ERROR END) and you get an error with x = ERROR, then your program must clear the error variable with ERROR = _noErr

See AlsoEdit

ON ERROR FN;ON ERROR RETURN; ERROR; SYSERROR