Errors
catch_autocomplete
#
catch_autocomplete(
*exceptions: type[Exception],
) -> Callable[
[AutocompleteErrorHandlerCallbackT[Any]],
Includable[AutocompleteErrorHandlerCallbackT[Any]],
]
Catch an exception or subclasses of an exception passed into this function when the exception is raised in an autocomplete handler.
Example#
@client.include
@crescent.catch_autocomplete(Exception)
async def on_autocomplete_random_error(
exc: Exception,
ctx: crescent.AutocompleteContext,
inter: hikari.AutocompleteInteractionOption,
) -> None:
print(f"{exc} raised in autocomplete for {ctx.command}!")
# An autocomplete callback that a command is using.
async def example_autocomplete(
ctx: crescent.AutocompleteContext, option: hikari.AutocompleteInteractionOption
) -> list[tuple[str, str]]:
raise Exception
catch_command
#
catch_command(
*exceptions: type[Exception],
) -> Callable[
[CommandErrorHandlerCallbackT[Any]],
Includable[CommandErrorHandlerCallbackT[Any]],
]
Catch an exception or subclasses of an exception passed into this function when the exception is raised in a command.