I want to stop a procedure that adds a record if the server is not connected and then do other things: trying to reconnect and if that fails, telling the user to contact me. Since I am using a VPN to connect to the server network, I can easily turn it on and off in order to test my code. Here is the code I have tried:
checkserverconnection "SD PanX Server" if error console "Sorry, server is not connected." //[More code...] else console "server ok" endif
With the VPN connected, I get the console message ‘server ok’. But if I disconnect the VPN connection then run the code, I get the default error dialog after the timeout period (set for 20 seconds) for trying to make a connection and the procedure stops.
Looks like ‘if error’ did not trap the error. But also, if I insert a server that does not exist, the error is trapped immediately and I get my console message.
I am going to try to use try/catch to see if that works.