fix(tree): Correct logstack for acmpl.

This commit is contained in:
2023-10-08 07:30:44 +03:00
parent 7ae1c5cb51
commit 7583682cfc

View File

@@ -38,8 +38,9 @@ class LionTree(CommandTree):
await self.error_reply(interaction, embed) await self.error_reply(interaction, embed)
except Exception: except Exception:
logger.exception(f"Unhandled exception in interaction: {interaction}", extra={'action': 'TreeError'}) logger.exception(f"Unhandled exception in interaction: {interaction}", extra={'action': 'TreeError'})
embed = self.bugsplat(interaction, error) if interaction.type is not InteractionType.autocomplete:
await self.error_reply(interaction, embed) embed = self.bugsplat(interaction, error)
await self.error_reply(interaction, embed)
async def error_reply(self, interaction, embed): async def error_reply(self, interaction, embed):
if not interaction.is_expired(): if not interaction.is_expired():
@@ -144,7 +145,10 @@ class LionTree(CommandTree):
raise AppCommandError( raise AppCommandError(
'This should not happen, but there is no focused element. This is a Discord bug.' 'This should not happen, but there is no focused element. This is a Discord bug.'
) )
await command._invoke_autocomplete(interaction, focused, namespace) try:
await command._invoke_autocomplete(interaction, focused, namespace)
except Exception as e:
await self.on_error(interaction, e)
return return
set_logging_context(action=f"Run {command.qualified_name}") set_logging_context(action=f"Run {command.qualified_name}")