]> git.aero2k.de Git - urlbot-v3.git/commitdiff
some resilience and logging output
authorThorsten <mail@aero2k.de>
Sat, 20 Jun 2020 15:30:38 +0000 (17:30 +0200)
committerThorsten <mail@aero2k.de>
Sat, 20 Jun 2020 15:30:38 +0000 (17:30 +0200)
distbot/bot/worker.py

index 04aa8ae48d0ffb164d1332314b7c606b72b192e0..2a86701a8b9079de44f1fc4c953fc2c43e40cb80 100644 (file)
@@ -60,7 +60,12 @@ class Worker(threading.Thread):
     def callback(self, ch, method, properties, body):
         logger.debug("Reacting on %s in %s", str(method.routing_key), self.get_subclass_name())
         body = json.loads(body.decode("utf-8"))
-        self.used_channel = method.routing_key.split(".")
+        try:
+            self.used_channel = method.routing_key.split(".")
+        except TypeError as e:
+            logging.error(f"{str(method.routing_key)} is of type {type(method.routing_key)}")
+            logging.exception(e)
+            self.used_channel = ["__error__"]
 
         if self.uses_history:
             self.history = self.total_history[body["to"]]