error handling improved

This commit is contained in:
Wolfgang Hottgenroth
2022-02-05 11:08:49 +01:00
parent 008713167d
commit 1a321b4712
2 changed files with 5 additions and 4 deletions

View File

@ -35,9 +35,8 @@ class MqttPublish(AbstractMqttPublisher):
payload = { "count": cnt, "uptime": uptime }
self.client.publish(self.statusTopic, json.dumps(payload), retain=True)
except Empty:
if self.killBill:
logger.error("killbill received")
break
# just evaluate the killBill at the top of the loop again
pass
except Exception as e:
logger.error(f"Exception {type(e)} received in MQTT local loop: {e}")

View File

@ -38,8 +38,10 @@ class OpcUaRequester(threading.Thread):
except ua.UaError as e:
logger.error(f"UaError in inner OPC-UA loop: {type(e)} {e}")
await asyncio.sleep(self.delay)
except TimeoutError as e:
except asyncio.exceptions.TimeoutError as e:
logger.error(f"Timeout in inner OPC-UA loop")
except Exception as e:
logger.error(f"Exception in inner OPC-UA loop: {type(e)} {e}")
def run(self):
loop = asyncio.new_event_loop()