[Dev] Fix __repr__() errors in REPL when referencing an instance of a class & catch Exception (#5794)

* initial fix (test)

* Replace instances of bare excepts by catching Exception
This commit is contained in:
Kreusada Tagiazala 2022-08-23 01:32:02 +01:00 committed by GitHub
parent 6f04698013
commit cadcffbae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,7 +204,7 @@ class Dev(commands.Cog):
try:
with redirect_stdout(stdout):
result = await func()
except:
except Exception:
printed = "{}{}".format(stdout.getvalue(), traceback.format_exc())
else:
printed = stdout.getvalue()
@ -293,13 +293,16 @@ class Dev(commands.Cog):
else:
result = executor(code, env)
result = await self.maybe_await(result)
except:
except Exception:
value = stdout.getvalue()
msg = "{}{}".format(value, traceback.format_exc())
else:
value = stdout.getvalue()
if result is not None:
try:
msg = "{}{}".format(value, result)
except Exception:
msg = "{}{}".format(value, traceback.format_exc())
env["_"] = result
elif value:
msg = "{}".format(value)