diff --git a/edmond/bot.py b/edmond/bot.py index 907aa40..3f00c73 100644 --- a/edmond/bot.py +++ b/edmond/bot.py @@ -126,7 +126,7 @@ class Bot(irc.client.SimpleIRCClient, Logger): except KeyboardInterrupt: self.log_i("Caught keyboard interrupt.") except Exception as exc: - self.log_c(f"Caught unhandled exception: {exc}") + self.log_c(f"Caught unhandled {type(exc)}: {exc}") _, _, exc_traceback = sys.exc_info() for line in traceback.format_tb(exc_traceback): self.log_d(line.rstrip()) diff --git a/edmond/plugins/journee_mondiale.py b/edmond/plugins/journee_mondiale.py index 078cbe8..3b1c563 100644 --- a/edmond/plugins/journee_mondiale.py +++ b/edmond/plugins/journee_mondiale.py @@ -81,12 +81,13 @@ class JourneeMondialePlugin(Plugin): try: items = soup.find("div", id="journeesDuJour").find_all("article") for item in items: - entries.append( - { - "url": item.find("a")["href"], - "title": item.find("h2").string, - } - ) + if (first_link := item.find("a")) is None: + continue + if (first_title := item.find("h2")) is None: + continue + link = first_link["href"] + title = first_title.string + entries.append({"url": link, "title": title}) except (ValueError, KeyError): return ""