Error Handling In Visual FoxPro - WeOnlyDo Discussion board

Error Handling In Visual FoxPro (General questions)

by ProductTester, Friday, November 02, 2007, 19:36 (6231 days ago)

Our development staff is very interested in your product for FTP-SSL transfer - it seems to be exactly what we are looking for and until we reached this point, were planning to purchase multiple copies.

However, we wish to receive notification of our connection status/errors, as well as file transfer states. Although some form of error handling been implemented in the example files you provide, it doesn't appear to be possible in our Visual FoxPro applications -- we already have an error handler that we wish to remain active, we just want to track the status/error codes and display our own text to the client. Can you give us some examples of implementing notification in VFP?

Re: Error Handling In Visual FoxPro

by wodDamir, Friday, November 02, 2007, 19:58 (6231 days ago) @ ProductTester

Hi,

I'm not sure what you're reffering to. The component provides Error descriptions, which you can change to whatever you want and provide it that way to the end user.

The events also provide the Errors which might occur.

Also, you can use the try...catch blocks in order to trap the error, and change the error to whatever text you want.

As for Connection status, you can access the State Property to check what state the component is currently. This is also provided in the StateChange Event.

Hope I helped.

Regards,
Damba

Re: Error Handling In Visual FoxPro

by ProductTester, Friday, November 02, 2007, 20:33 (6231 days ago) @ wodDamir

Thanks for you quick response. Let me clarify.

Using the FoxPro example from these formus, when I get to the command sftp.connect, if there is no connection, I get an OLE Exception error. How can I trap this error in FoxPro without disabling my currently active error handler?

Re: Error Handling In Visual FoxPro

by wodDamir, Friday, November 02, 2007, 21:49 (6231 days ago) @ ProductTester

Hi,

Did you try the Error Event? The Error event should be triggered once an error occurs.

Other then that, you can try using ON ERROR statement. This would allow you to create a new class or event in which you could then handle errors.

However, if you are using VFP 7+, you should be able to use Try...Catch...Finally blocks on methods to catch the error silently.

Hope I helped.

Regards,
Damba