diff --git a/tangostationcontrol/tangostationcontrol/clients/opcua_client.py b/tangostationcontrol/tangostationcontrol/clients/opcua_client.py index 813ec9908a55686a2359a22926e0beec9e07dd63..073933ad7dc01576e3817505c81c970fbe87ff1d 100644 --- a/tangostationcontrol/tangostationcontrol/clients/opcua_client.py +++ b/tangostationcontrol/tangostationcontrol/clients/opcua_client.py @@ -216,11 +216,10 @@ class OPCUAConnection(AsyncCommClient): node = await self.get_node(method_path[:-1]) result = await node.call_method(method_path[-1], *args) except Exception as e: - raise Exception(f"Calling method {method_path} failed") from e + raise RuntimeError(f"Calling method {method_path} failed") from e return result - def call_method(self, method_path, *args): return asyncio.run_coroutine_threadsafe(self._call_method(method_path, *args), self.event_loop).result() diff --git a/tangostationcontrol/tangostationcontrol/integration_test/default/client/test_opcua_client_against_server.py b/tangostationcontrol/tangostationcontrol/integration_test/default/client/test_opcua_client_against_server.py index 8a1d035f64a57b9b96046c0e27720623fa62b9ec..3ce57a0ae8660ac040a3cff0f5ef8680c5909ebc 100644 --- a/tangostationcontrol/tangostationcontrol/integration_test/default/client/test_opcua_client_against_server.py +++ b/tangostationcontrol/tangostationcontrol/integration_test/default/client/test_opcua_client_against_server.py @@ -45,7 +45,9 @@ class TestClientServer(base.IntegrationAsyncTestCase): @asyncua.uamethod def throws(parent): - raise RuntimeError("Expected test exception") + """This is not the exception raised by the opcua_client since it will + be caught""" + raise ArithmeticError("Expected test exception") multiply_method = await obj.add_method(idx, "multiply", multiply, [asyncua.ua.VariantType.Double, asyncua.ua.VariantType.Int64], [asyncua.ua.VariantType.Double]) procedure_method = await obj.add_method(idx, "procedure", procedure, [], []) @@ -62,7 +64,9 @@ class TestClientServer(base.IntegrationAsyncTestCase): await self.server.stop() def fault_func(self): - raise RuntimeError("FAULT") + """This is not the exception raised by the opcua_client since it will + be caught""" + raise ArithmeticError("FAULT") async def test_opcua_connection(self): await self.setup_server(14840)