Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get VFP OLE Server to use error procedure
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00097111
Message ID:
00097450
Views:
27
>Great thread--thanks for the question.
>
>I think return to master would work if you made your clients call a single method, passing a string with the method (and any parameters) they want to call, but that's a pretty ugly approach.

You mean something like an Execution method that takes parameters for the internal method to call? Like the client calls only _one_ method in the server all the time and passes in which method to run. Hmmm...Actually that doesn't sound like a bad idea. This way if there is an error, it will run the Error method, and RETURN TO MASTER. Maybe that could work.


>
>I know in some of Bob Greens' sample code from last DevCon, his server had a property called "LastErrMsg" or something of that nature. You could use that approach to give your users a more descriptive error message.

I don't have any reference to that code.

>
>I'm curious--how does Delphi know the server cancelled? Issueing a CANCEL in the error method is sufficient?

Actually Delphi raises an exception because the VFP server returns the wrong type of information. The variable I have set up to receive the return from the server is an integer type and VFP returns some erroneous string when it CANCELs. So that raises the exception. If you look at the code I posted to nmy message to David, you can see in the try...except block is where the exception gets handled gracefully.

>
>Finally, (I'm sure you have this covered) when cancelling from the error routine make sure to rollback any transactions and revert any buffered changes.

Yup! The Error method calls the Cleanup.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform