From f23c2e78fb9ac6e6c2f7faeaeaf652c89ad8c263 Mon Sep 17 00:00:00 2001 From: Boris Muratov <8bee278@gmail.com> Date: Tue, 26 Jan 2021 18:06:32 +0200 Subject: Make the cog update even if write to DB fails The defcon cog should be functional even if there is some issue with writing to the DB for some reason. The functionality should have retention across restarts, but it shouldn't be its failing point. If necessary, it should be able to work with no DB at all --- bot/exts/moderation/defcon.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/exts/moderation/defcon.py b/bot/exts/moderation/defcon.py index 4b25c36df..00b108feb 100644 --- a/bot/exts/moderation/defcon.py +++ b/bot/exts/moderation/defcon.py @@ -157,13 +157,13 @@ class Defcon(Cog): } ) - self.days = timedelta(days=days) - self.update_notifier() - except Exception as err: log.exception("Unable to update DEFCON settings.") error = err finally: + self.days = timedelta(days=days) + self.update_notifier() + await ctx.send(self.build_defcon_msg(action, error)) await self.send_defcon_log(action, ctx.author, error) -- cgit v1.2.3