Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teltonika exception #204

Open
pascalzauberzeug opened this issue Oct 21, 2024 · 0 comments · May be fixed by #212
Open

Teltonika exception #204

pascalzauberzeug opened this issue Oct 21, 2024 · 0 comments · May be fixed by #212
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@pascalzauberzeug
Copy link
Contributor

When no connection to the Teltonika router can be established, the exception message is quite long.
Can we implement better handling?

rosys_1       | 2024-10-21 13:28:20.974 [ERROR] field_friend/hardware/teltonika_router.py:51: Getting Internet Connection Info: failed
rosys_1       | Traceback (most recent call last):
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 170, in try_connect
rosys_1       |     stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
rosys_1       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2268, in connect_tcp
rosys_1       |     await get_running_loop().create_connection(
rosys_1       |   File "uvloop/loop.pyx", line 2039, in create_connection
rosys_1       |   File "uvloop/loop.pyx", line 2016, in uvloop.loop.Loop.create_connection
rosys_1       | ConnectionRefusedError: [Errno 111] Connection refused
rosys_1       | 
rosys_1       | The above exception was the direct cause of the following exception:
rosys_1       | 
rosys_1       | Traceback (most recent call last):
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
rosys_1       |     yield
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
rosys_1       |     stream: anyio.abc.ByteStream = await anyio.connect_tcp(
rosys_1       |                                    ^^^^^^^^^^^^^^^^^^^^^^^^
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 232, in connect_tcp
rosys_1       |     raise OSError("All connection attempts failed") from cause
rosys_1       | OSError: All connection attempts failed
rosys_1       | 
rosys_1       | The above exception was the direct cause of the following exception:
rosys_1       | 
rosys_1       | Traceback (most recent call last):
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
rosys_1       |     yield
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
rosys_1       |     resp = await self._pool.handle_async_request(req)
rosys_1       |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
rosys_1       |     raise exc
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
rosys_1       |     response = await connection.handle_async_request(request)
rosys_1       |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 92, in handle_async_request
rosys_1       |     raise exc
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 69, in handle_async_request
rosys_1       |     stream = await self._connect(request)
rosys_1       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 117, in _connect
rosys_1       |     stream = await self._network_backend.connect_tcp(**kwargs)
rosys_1       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
rosys_1       |     return await self._backend.connect_tcp(
rosys_1       |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 112, in connect_tcp
rosys_1       |     with map_exceptions(exc_map):
rosys_1       |   File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
rosys_1       |     self.gen.throw(typ, value, traceback)
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
rosys_1       |     raise to_exc(exc) from exc
rosys_1       | httpcore.ConnectError: All connection attempts failed
@LukasBaecker LukasBaecker linked a pull request Oct 22, 2024 that will close this issue
@LukasBaecker LukasBaecker added this to the 0.6.0 milestone Oct 22, 2024
@LukasBaecker LukasBaecker added the enhancement New feature or request label Oct 22, 2024
@LukasBaecker LukasBaecker linked a pull request Oct 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants