Swap order of arguments in Modal.on_error

This commit is contained in:
Server Bot 2022-05-07 05:46:42 +05:30 committed by GitHub
parent bd3ce597e1
commit 902aa245a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,7 +148,7 @@ class Modal(View):
"""
pass
async def on_error(self, error: Exception, interaction: Interaction) -> None:
async def on_error(self, interaction: Interaction, error: Exception) -> None:
"""|coro|
A callback that is called when :meth:`on_submit`
@ -158,10 +158,10 @@ class Modal(View):
Parameters
-----------
error: :class:`Exception`
The exception that was raised.
interaction: :class:`~discord.Interaction`
The interaction that led to the failure.
error: :class:`Exception`
The exception that was raised.
"""
print(f'Ignoring exception in modal {self}:', file=sys.stderr)
traceback.print_exception(error.__class__, error, error.__traceback__, file=sys.stderr)
@ -186,7 +186,7 @@ class Modal(View):
await self.on_submit(interaction)
except Exception as e:
return await self.on_error(e, interaction)
return await self.on_error(interaction, e)
else:
# No error, so assume this will always happen
# In the future, maybe this will require checking if we set an error response.