Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to reset AERROR
Message
From
02/03/2018 05:04:04
 
 
To
02/03/2018 04:49:02
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 10
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01658499
Message ID:
01658504
Views:
44
>>>>I was wondering if there is a way to reset the last error Information from AERROR(). The reason is because I try to catch an OLE error, which may or may not put Information into the AERROR() array, but when there has been some other error before, the first error would still appear in the array and would then give a wrong Impression when I do IF ARROR(laError) > 0.
>>>>
>>>>In case there was no output from the OLE error, the ARROR(laError) command shows the same old error as before, but I can't know if that is the new error or the old one.
>>>
>>>You can (re)dimension and clear the array before calling Aerror()..
>>>
>>>
Dimension laError(7)
>>>laError=''
>>>If AError(laError)
>>> ...
>>
>>I tried that, but the laError array gets newly created from the AERROR command with always the Information from the last error that happened. If no error ever happend in the application, AERROR(laError) returns 0. But after the first error was generated, it always returns 1. So the check on IF AERROR(laError) is not conclusive.
>>
>>The real problem is that an error can occur in Word automation at loWord.Selection.Inlineshapes.AddPicture("C:\Files\Test.bmp",.F.,.T:). However it does not always generate a VFP error, depending on the reason for the error. If for instance the file does not exist, it gives a regular error in VFP which I can catch with TRY/CATCH, which also produces Information in AERROR(), But when the file access is denied, I only can catch that when the call returns a NULL object, VFP does not raise an error. In which case I can't get any Information about the error from Word, but I want to check if there is something in the AERROR() array just in case. (Because it happens at one client where I don't have insight into their system). So here I want to check IF ARROR(laError) > 0, but unfortunately it is always 1.
>
>Can't you use more than one array?

The array is not the problem itself, because it always gets generated on the fly. For instance AERROR(laTest1) and ARROR(laTest2) both create the same arrays. There is something in the VFP memory that saves the last error and that gets put into the array, until a new error happens. So until now I did not find a way to clear that last error information. I would have expected something like CLEAR ERRORS. Not even CLEAR ALL does get rid of the last error Information.

I am thinking if I first check the array content before and after, I can at least see if there was anything new in the error message. So that would be probably the solution.
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform