Browse Source

Swap order of arguments in Modal.on_error

pull/8006/head
Server Bot 3 years ago
committed by GitHub
parent
commit
902aa245a4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      discord/ui/modal.py

8
discord/ui/modal.py

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

Loading…
Cancel
Save