agronholm / agronholm/mqttproto

Connection failure doesn't raise an exception

Abierto
#16 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
23
Forks
6
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I'm running pytest against my server which happens to require a login.

As the connection didn't succeed I'd expect the `async with AsyncMQTTClient()` call to raise an appropriate exception instead of continuing.
```
-> async def _run_operation(self, operation: MQTTOperation[Any]) -> None:
(Pdb) b 481
Breakpoint 1 at /src/mqttproto/src/mqttproto/async_client.py:481
(Pdb) c

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB continue >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /src/mqttproto/src/mqttproto/async_client.py(481)_run_operation()
-> if operation.exception:
(Pdb) p operation.exception
None
(Pdb) p operation.response.reason_code

(Pdb) c
………
| Traceback (most recent call last):
| File "/src/mqttproto/tests/test_async_client.py", line 14, in test_publish_subscribe
| async with client.subscribe("test/+") as messages:

| mqttproto.MQTTProtocolError: cannot perform this operation in the DISCONNECTED state (must be in one of the following states: CONNECTED)
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.