Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Catch not Firing
Message
From
18/04/2003 18:44:17
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00779148
Message ID:
00779385
Views:
9
Just to confirm and for Mike’s benefit I retested this and it has nothing to do with the Try-Catch. It is a problem with ERASE on XP. Here is what I did.

3 workstations and a server.

On one workstation open up a word document on the server.

On Win2K machine open VFP8, CD to the folder with the word document.
Issue Erase The.Doc. As expected, I get an error “File access is denied”

On the XP machine open VFP8, CD to the folder with the word document.
Issue Erase The.Doc. No error!

There is definitely something wrong here.





>>
>>      try
>>         erase (lcSecondDoc)
>>         if file(lcSecondDoc)
>>            wait window 'Erase clearly failed because the file still exist! Catch should fire.'
>>         endif
>>      catch
>>         wait window 'Document in use'
>>         .ActiveDocument.close(0)
>>         .application.quit
>>         oWord = .null.
>>         release oWord
>>         llReturn = .t.
>>      endtry
>>
>
>Robert,
>
>The CATCH in this case is not firing because no error has occurred (according to Fox). Move your ERASE out of the TRY/CATCH and you will see that no error is generated. The ERASE command does not generate errors. If you want to catch an error for this, you could put an ERROR command or THROW command where your WAIT WINDOW is.
Previous
Reply
Map
View

Click here to load this message in the networking platform