Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error Handling Priority
Message
From
30/09/2013 11:53:24
 
 
To
29/09/2013 11:34:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01584109
Message ID:
01584451
Views:
36
>Hi Rich.
>
>>So. Assuming that all of the following exist
>>
>>1. ON ERROR
>>2. Form Error Method Code
>>3.. Control Error Method Code
>>4. TRY/CATCH code
>>
>>What is the sequence in which the error checking takes place?
>
>Normally TRY takes precedence but if the TRY code calls a method of an object, that method causes an error, and that object has code in its Error method (or one of its ancestors do), the Error method is called. If it doesn't have code in Error, then ON ERROR executes. IOW, TRY only takes precedence for errors that occur directly in the code in TRY, not in methods called from TRY.
>
>Doug

Thank you Doug. But from the following code it seems that TRY/CATCH will take precedence for code in methods called from within the block, even if ON ERROR exists.
** command1.click
SET STEP ON 
ON ERROR MESSAGEBOX("this is an error")
try
thisform.m1()
CATCH
ab=123
endtry

** thisform.m1
a = 1 + "A"
Stepping though the code the CATCH block does get executed rather than the ON ERROR. Bear in mind VFP 8 so it might be something that was changed (or I misread your explanation).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform