Raising errors inside checks or commands don't call error events
Summary
Making checks raise their own errors so that it doesn't just raise the generic .CheckFailure seems to be giving fatal errors and stopping the bot from running anymore on VSCode.
Reproduction Steps
- Make a custom check that raises an error from discord.errors or subclassed from one of them
- observe
Minimal Reproducible Code
def require_js():
async def predicate(ctx):
config = await ctx.bot.cogs["JoinLeave"].get_config(ctx.guild.id)
if config == None:
raise commands.BadArgument('Welcome messages are disabled.')
else:
if config.join.toggle == False:
raise commands.BadArgument('Welcome messages are disabled.')
ctx.config = config
return True
return commands.check(predicate)
used in the command: (in a cog)
@joinsettings.group(name="message", invoke_without_command=True)
@require_js()
async def js_message(self, ctx, *, message:typing.Optional[str]):
...
error handler: (in bot subclass)
async def on_command_error(self, ctx, error):
if ...:
...
elif isinstance(error, commands.BadArgument):
if ...:
...
else:
try:
await ctx.send(f'❔ {str(error).split(":")[0]}')
except IndexError:
await ctx.send(f'❔ {str(error)}')
Expected Results
Bot says Welcome messages are disabled
Actual Results
Bot stops running

Intents
None
System Information
- Python v3.9.0-final
- py-cord v2.0.0-alpha
- py-cord pkg_resources: v2.0.0a4148+g2bbf063
- aiohttp v3.6.2
- system info: Windows 10 10.0.19041
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
I cannot reproduce this error with the code provided
I cannot reproduce this error with the code provided
Are you using VSCode and the error is going to the event?
I've updated the issue description with a matching image and more code
Also errors aren't working inside the command:

Somehow works now