From 0fa9bfc925b9fc37dbdae925998a6a0101146db2 Mon Sep 17 00:00:00 2001 From: Snaptraks <33529661+Snaptraks@users.noreply.github.com> Date: Tue, 12 Apr 2022 21:15:16 -0400 Subject: [PATCH] Correct order of arguments in View.on_error --- discord/ui/view.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/discord/ui/view.py b/discord/ui/view.py index 3e753fbfe..64b2823d5 100644 --- a/discord/ui/view.py +++ b/discord/ui/view.py @@ -381,7 +381,7 @@ class View: """ pass - async def on_error(self, error: Exception, item: Item[Any], interaction: Interaction) -> None: + async def on_error(self, interaction: Interaction, error: Exception, item: Item[Any]) -> None: """|coro| A callback that is called when an item's callback or :meth:`interaction_check` @@ -391,12 +391,12 @@ class View: Parameters ----------- + interaction: :class:`~discord.Interaction` + The interaction that led to the failure. error: :class:`Exception` The exception that was raised. item: :class:`Item` The item that failed the dispatch. - interaction: :class:`~discord.Interaction` - The interaction that led to the failure. """ print(f'Ignoring exception in view {self} for item {item}:', file=sys.stderr) traceback.print_exception(error.__class__, error, error.__traceback__, file=sys.stderr) @@ -412,7 +412,7 @@ class View: await item.callback(interaction) except Exception as e: - return await self.on_error(e, item, interaction) + return await self.on_error(interaction, e, item) def _start_listening_from_store(self, store: ViewStore) -> None: self.__cancel_callback = partial(store.remove_view)