Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SDT and Error Handling
Message
 
 
To
19/05/2005 12:45:31
General information
Forum:
Visual FoxPro
Category:
Stonefield
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01013546
Message ID:
01016036
Views:
12
>Thanks for the idea mark, but I cannot issue Retry at that point because then it goes into an infinite loop of retrying:
>
>oMeta.oSDTMgr.Update(oMeta.oSDTMgr.cAlias)
>
>which was not what the original command was, but rather it should be:
>
>oMeta.oSDTMgr.OpenTable(ufile, uorder, uexclu, ualias, .F., usession)
>
>Now this would happen if the ON ERROR called a function instead of a procedure and value could be returned so I have tested that as well. However, when I call a function instead:
>
>ON ERROR ErrorHandler(ERROR(), MESSAGE(), LINENO())
>
>and then it goes tot he ErrorHandler function, the value of ERROR() being passed gets changed to 0 at that point and it should be 1 (in this case). Retry is never passed back (where the dbcxmgr would issue it correctly) because the case statement never gets processed in errorhandler.
>
>If it's not one thing it is another!

The problem you are experiencing is there is no variable for your error handler to be returning a value to when an error occurs. Even though you have:

ON ERROR ErrorHandler(ERROR(), MESSAGE(), LINENO())

when your ErrorHandler finishes its execution and returns a value, there is nowhere for that value to go. About the only thing you can do is have your error handler set the value of a global application property. So when your code detects that property is a certain value, then you can branch off and do whatever you need to do.
goApp.lErrorHappened = .f.
* Do something that triggers an error here.
* The ErrorHandler function sets the lErrorHappened property to .T.
if goApp.lErrorHappened
   * fix the problem
endif
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform