Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design question - how to interrupt process
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01018971
Message ID:
01019043
Views:
20
Hi Chad,

When I set cError, I also log it into the LogFile. I guess, RunProcess will return .f. if the object is destroyed.

e.g. calling procedure:
loProcess = newobject('aAssignQueues','aQueueProcess.vcx')
llReturn = loProcess.RunProcess(....)

if vartype(m.loProcess) =  'O' && object was not destroyed due to the error
  ...
endif
The reason I want to destroy the object in case of error is that otherwise in my RunProcess I have to check every time, if no error occurs so far...


>Nadya,
>
>If the object releases itself upon setting the cError property, how will the calling object know there was an error or what it was? I would think that you would just want your RunProcess method to return a value (maybe true/false or some numeric return codes). Then, your calling object could just create the object, call RunProcess, check the return value for success or failure, and if failure, check the cError property. Then, once the RunProcess either finished successfully or the cError property was checked and acted upon, the calling object could destroy the BusinessProcess (if necessary).
>
>Typically, the only time you want objects to destroy themselves is when they run unattended (or in another thread) and can log results by themselves to someplace that remains after the object is gone. Such as an object that creates a log file of what it did as it ran overnight.
>
>HTH,
>Chad
>
>>Hi everybody,
>>
>>I'm creating a custom class called BusinessProcess. In this class I'm going to have RunProcess method. If some error conditions occur, I want to be able to stop the process immediatelly.
>>
>>I have cError property. If I set this property to something, it means, I have an error and want to stop. My question is: is it advisable to create a custom Release method (call Destroy() in it) and call this method in cError_Assign?
>>
>>Or there are better ideas?
>>
>>Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform