diff options
author | 2022-10-19 21:06:51 -0500 | |
---|---|---|
committer | 2022-10-19 21:06:51 -0500 | |
commit | 3370c8763ad86198e3b010d72bdf1b14b7f8ff7b (patch) | |
tree | f7fd85d58ce3c741c20bc304fe0c5f5794c284df | |
parent | Update proper-error-handling.md (diff) |
Use 4 spaces as tab
Uses 4 spaces for a tab rather than two, as is convention
-rw-r--r-- | pydis_site/apps/content/resources/guides/python-guides/proper-error-handling.md | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/pydis_site/apps/content/resources/guides/python-guides/proper-error-handling.md b/pydis_site/apps/content/resources/guides/python-guides/proper-error-handling.md index e0606625..74b0f59b 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/proper-error-handling.md +++ b/pydis_site/apps/content/resources/guides/python-guides/proper-error-handling.md @@ -14,20 +14,20 @@ import sys class MyBot(commands.Bot): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) - async def on_command_error(self, ctx: commands.Context, error): - # Handle your errors here - if isinstance(error, commands.MemberNotFound): - await ctx.send("I could not find member '{error.argument}'. Please try again") + async def on_command_error(self, ctx: commands.Context, error): + # Handle your errors here + if isinstance(error, commands.MemberNotFound): + await ctx.send("I could not find member '{error.argument}'. Please try again") - elif isinstance(error, commands.MissingRequiredArgument): - await ctx.send(f"'{error.param.name}' is a required argument.") - else: - # All unhandled errors will print their original traceback - print(f'Ignoring exception in command {ctx.command}:', file=sys.stderr) - traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr) + elif isinstance(error, commands.MissingRequiredArgument): + await ctx.send(f"'{error.param.name}' is a required argument.") + else: + # All unhandled errors will print their original traceback + print(f'Ignoring exception in command {ctx.command}:', file=sys.stderr) + traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr) bot = MyBot(command_prefix="!", intents=discord.Intents.default()) @@ -43,16 +43,16 @@ import traceback import sys async def on_command_error(self, ctx: commands.Context, error): - # Handle your errors here - if isinstance(error, commands.MemberNotFound): - await ctx.send("I could not find member '{error.argument}'. Please try again") - - elif isinstance(error, commands.MissingRequiredArgument): - await ctx.send(f"'{error.param.name}' is a required argument.") - else: - # All unhandled errors will print their original traceback - print(f'Ignoring exception in command {ctx.command}:', file=sys.stderr) - traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr) + # Handle your errors here + if isinstance(error, commands.MemberNotFound): + await ctx.send("I could not find member '{error.argument}'. Please try again") + + elif isinstance(error, commands.MissingRequiredArgument): + await ctx.send(f"'{error.param.name}' is a required argument.") + else: + # All unhandled errors will print their original traceback + print(f'Ignoring exception in command {ctx.command}:', file=sys.stderr) + traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr) bot = commands.Bot(command_prefix="!", intents=discord.Intents.default()) bot.on_command_error = on_command_error |