From fdaca949e134f280034b65e8f9aa6890db4600d1 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Sun, 22 Mar 2020 23:56:17 +0100 Subject: Deseasonify: add exceptions module When loading extensions, d.py circumvents the import cache by force-reloading the target module. As a consequence, exception class declaration get re-executed, which may cause the error handler to not recognize the exception via its `isinstance` checks - the raised exception may not be an instance of the class that the error handler originally imported. For this reason, it is safer to declare the exceptions on the side, in a module that will not be reloaded by d.py. --- bot/exceptions.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 bot/exceptions.py (limited to 'bot/exceptions.py') diff --git a/bot/exceptions.py b/bot/exceptions.py new file mode 100644 index 00000000..70c20e12 --- /dev/null +++ b/bot/exceptions.py @@ -0,0 +1,4 @@ +class BrandingError(Exception): + """Exception raised by the BrandingManager cog.""" + + pass -- cgit v1.2.3