forked from M-Labs/thermostat
Correct exception catching
asyncio.Task.result() is simply going to throw the exception in asyncio.Task.exception(), there is no need to manually throw it.
This commit is contained in:
parent
fae0c4141d
commit
1b64a88c75
@ -40,15 +40,13 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
||||
self.task = asyncio.create_task(self.update_params())
|
||||
while True:
|
||||
if self.task.done():
|
||||
if self.task.exception() is not None:
|
||||
try:
|
||||
raise self.task.exception()
|
||||
_ = self.task.result()
|
||||
except asyncio.TimeoutError:
|
||||
logging.error(
|
||||
"Encountered an error while updating parameter tree.",
|
||||
exc_info=True,
|
||||
)
|
||||
_ = self.task.result()
|
||||
self.task = asyncio.create_task(self.update_params())
|
||||
await asyncio.sleep(self._update_s)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user