Microsoft KB Archive/96286

= ON ERROR Does Not Trap All Errors =

PSS ID Number: 96286

Article Last Modified on 10/23/1999

-

The information in this article applies to:


 * Microsoft FoxBASE+ for Macintosh 2.01

-



This article was previously published under Q96286



SUMMARY
Using the ON ERROR command may not trap all error conditions. Specifically, if the ON ERROR command does not call a procedure, it will trap only the first occurrence of an error. All subsequent errors will be handled by FoxBASE+/Mac internally.



MORE INFORMATION
The following code example demonstrates how the ON ERROR command is executed only on the first occurrence of an error. The second and third occurrences of the same error are not handled by the defined ON ERROR command, but rather by the internal FoxBASE+/Mac error handling routine. ON ERROR ALERT STOP 1 STR(ERROR)

3=x     * returns error number 12 3=x     * returns message &quot;Variable not found&quot; 3=x     * returns message &quot;Variable not found&quot; A workaround is to place the ON ERROR command in a procedure, as shown below: filename = SYS(16) SET PROCEDURE TO &filename

ON ERROR DO ErrorProc

3=x    * returns error number 12 3=x    * returns error number 12 3=x    * returns error number 12

PROCEDURE ErrorProc ALERT STOP 1 STR(ERROR) RETURN

Additional query words: 2.01

Keywords: KB96286

Technology: kbAudDeveloper kbFoxBASE201Mac kbFoxBASESearch kbFoxproSearch kbHWMAC kbOSMAC

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.