Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Try...catch...finally
Message
From
27/10/2002 18:14:51
 
 
To
27/10/2002 14:28:21
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00715709
Message ID:
00715916
Views:
15
Hilmar,

The way I understand it is that the code after the try block will execute either if there is no exception thrown, or if the catch clause that catches the particular exception does not redirect the flow - ie - with a return, for example.

The Finally clause will always be run regardless whether there is or is not an exception, and regardless whether or not the catch code redirects the flow.

For instance, if you get a divide by zero error, you're not going to want to run the code after the try block that displays the result of the calculation or whatever. In such an exception, the catch will either fix the calculation and not redirect flow, so that the display code outside the try block can execute sensibly, or it will not fix it, report the error, and do a return so that the display code does not execute.

Alan

>>Hi, Hilmer-
>>
>>>... And code outside the TRY construct is not always executed. Although I still don't completely understand the reason.
>>
>>It is not executed only when there is an error in the try block. It's not executed just means the method doesn't continue executing after the error (except, of course, for the finally).
>>
>>The reason? I guess that "catch" implies to FoxPro developers that we have a chance to catch and deal with the error and then continue on if we can fix it. Is that part of the problem, do you think?
>>
>>Writing that I realize that was my interpretation, too, when I first saw a Try/Catch.
>
>Yes, I guess I will have to investigate when I get hold of VFP 8 myself. For the moment, I am still with VFP 6 :(
>
>Hilmar.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform