is it possible to handle an XMLRPC exception in URScript ?
I have a program which makes an XMLRPC call to an external server, but if the server is not available I would like to have a default action and not abort the program. is there a way to catch this exception and handle it in URScript ?
Not really. You could try connecting to it by socket which will return a true or false and then choose to connect to the xmlrpc server based on that result.
I have had to just add this same logic in to mine, it seems to work well as the timeout for socket connection is much faster…
def NotifyConnect():
#Test connection with socket
TestSocketConnected = socket_open("192.168.1.242", 50042, "Test_XMLRPC")
if TestSocketConnected:
socket_close("Test_XMLRPC")
global XMLRPCConnected = True
#Connect to XML-RPC Server for notifications / logging.
global notify = rpc_factory("xmlrpc","http://192.168.1.242:50042/RPC2")
notify.NotifyMsg("Robot Started.")
else:
socket_close("Test_XMLRPC")
global XMLRPCConnected = False
end
end