forked from M-Labs/thermostat
Remove error handling for connecting task
Just let the exception propagate, even when stopping the connection
This commit is contained in:
parent
97d26e3c65
commit
1099f6d9ec
@ -191,21 +191,15 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.thermostat.connection_state = ThermostatConnectionState.CONNECTING
|
self.thermostat.connection_state = ThermostatConnectionState.CONNECTING
|
||||||
try:
|
await self._connecting_task
|
||||||
await self._connecting_task
|
self._connecting_task = None
|
||||||
except (OSError, asyncio.CancelledError) as exc:
|
|
||||||
await self.thermostat.end_session()
|
|
||||||
if isinstance(exc, asyncio.CancelledError):
|
|
||||||
return
|
|
||||||
raise
|
|
||||||
finally:
|
|
||||||
self._connecting_task = None
|
|
||||||
self.thermostat.connection_state = ThermostatConnectionState.CONNECTED
|
self.thermostat.connection_state = ThermostatConnectionState.CONNECTED
|
||||||
self.thermostat.start_watching()
|
self.thermostat.start_watching()
|
||||||
|
|
||||||
case ThermostatConnectionState.CONNECTING:
|
case ThermostatConnectionState.CONNECTING:
|
||||||
self._connecting_task.cancel()
|
self._connecting_task.cancel()
|
||||||
self.thermostat.connection_state = (
|
await self._thermostat.end_session()
|
||||||
|
self._thermostat.connection_state = (
|
||||||
ThermostatConnectionState.DISCONNECTED
|
ThermostatConnectionState.DISCONNECTED
|
||||||
)
|
)
|
||||||
self._connecting_task = None
|
self._connecting_task = None
|
||||||
|
Loading…
Reference in New Issue
Block a user