You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to handle some errors when calling the connect methode with the asyncua.sync.Client.
I want to inform the user why a connection was not successfull. (In my case the server would need a certificate for Basic256Sha256_SignAndEncrypt )
However i only get a ConnectionError Exception with almost no usefull information.
full stacktrace:
Traceback (most recent call last):
File "/workspaces/machine-imm-keba-opcua/machine_imm_keba_opcua/kebaopcuamachine.py", line 384, in _connect
self._opcua_client.connect()
File "/home/vscode/.local/lib/python3.8/site-packages/asyncua/sync.py", line 94, in wrapper
result = self.tloop.post(aio_func(*args, **kwargs))
File "/home/vscode/.local/lib/python3.8/site-packages/asyncua/sync.py", line 52, in post
return futur.result()
File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 444, in result
return self.__get_result()
File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
File "/home/vscode/.local/lib/python3.8/site-packages/asyncua/client/client.py", line 280, in connect
await self.create_session()
File "/home/vscode/.local/lib/python3.8/site-packages/asyncua/client/client.py", line 412, in create_session
response = await self.uaclient.create_session(params)
File "/home/vscode/.local/lib/python3.8/site-packages/asyncua/client/ua_client.py", line 404, in create_session
data = await self.protocol.send_request(request)
File "/home/vscode/.local/lib/python3.8/site-packages/asyncua/client/ua_client.py", line 212, in send_request
raise ConnectionError("Connection is closed") from None
ConnectionError: Connection is closed
On the console i can see that the asyncua logger has risen an error: (asyncua.uaprotocol): Received an error: ErrorMessage(Error=StatusCode(value=2153054208), Reason=None)
Is there any way to get the Error=StatusCode value in my exception handling? The message 'Connection is closed' is not very useful.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am trying to handle some errors when calling the connect methode with the asyncua.sync.Client.
I want to inform the user why a connection was not successfull. (In my case the server would need a certificate for Basic256Sha256_SignAndEncrypt )
so my code looks like this:
However i only get a ConnectionError Exception with almost no usefull information.
full stacktrace:
On the console i can see that the asyncua logger has risen an error:
(asyncua.uaprotocol): Received an error: ErrorMessage(Error=StatusCode(value=2153054208), Reason=None)
Is there any way to get the Error=StatusCode value in my exception handling? The message 'Connection is closed' is not very useful.
Thanks for any support.
Beta Was this translation helpful? Give feedback.
All reactions