mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 01:12:33 -05:00
[3.4] [Dev] Fix __repr__() errors in REPL when referencing an instance of a class & catch Exception (#5794) (#6065)
Co-authored-by: Kreusada Tagiazala <67752638+Kreusada@users.noreply.github.com>
This commit is contained in:
@@ -200,7 +200,7 @@ class Dev(commands.Cog):
|
|||||||
try:
|
try:
|
||||||
with redirect_stdout(stdout):
|
with redirect_stdout(stdout):
|
||||||
result = await func()
|
result = await func()
|
||||||
except:
|
except Exception:
|
||||||
printed = "{}{}".format(stdout.getvalue(), traceback.format_exc())
|
printed = "{}{}".format(stdout.getvalue(), traceback.format_exc())
|
||||||
else:
|
else:
|
||||||
printed = stdout.getvalue()
|
printed = stdout.getvalue()
|
||||||
@@ -289,13 +289,16 @@ class Dev(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
result = executor(code, env)
|
result = executor(code, env)
|
||||||
result = await self.maybe_await(result)
|
result = await self.maybe_await(result)
|
||||||
except:
|
except Exception:
|
||||||
value = stdout.getvalue()
|
value = stdout.getvalue()
|
||||||
msg = "{}{}".format(value, traceback.format_exc())
|
msg = "{}{}".format(value, traceback.format_exc())
|
||||||
else:
|
else:
|
||||||
value = stdout.getvalue()
|
value = stdout.getvalue()
|
||||||
if result is not None:
|
if result is not None:
|
||||||
|
try:
|
||||||
msg = "{}{}".format(value, result)
|
msg = "{}{}".format(value, result)
|
||||||
|
except Exception:
|
||||||
|
msg = "{}{}".format(value, traceback.format_exc())
|
||||||
env["_"] = result
|
env["_"] = result
|
||||||
elif value:
|
elif value:
|
||||||
msg = "{}".format(value)
|
msg = "{}".format(value)
|
||||||
|
|||||||
Reference in New Issue
Block a user