@@ -536,11 +536,11 @@ async def on_error(self, event_method: str, *args: Any, **kwargs: Any) -> None:
536536
537537 The default error handler provided by the client.
538538
539- By default, this prints to :data:`sys.stderr ` however it could be
539+ By default, this logs with :meth:`logging.error ` however it could be
540540 overridden to have a different implementation.
541541 Check :func:`~discord.on_error` for more details.
542542 """
543- print (f"Ignoring exception in { event_method } " , file = sys . stderr )
543+ _log . error (f"Ignoring exception in { event_method } " )
544544 traceback .print_exc ()
545545
546546 async def on_view_error (
@@ -553,27 +553,22 @@ async def on_view_error(
553553 This only fires for a view if you did not define its :func:`~discord.ui.View.on_error`.
554554 """
555555
556- print (
556+ _log . error (
557557 f"Ignoring exception in view { interaction .view } for item { item } :" ,
558- file = sys .stderr ,
559- )
560- traceback .print_exception (
561- error .__class__ , error , error .__traceback__ , file = sys .stderr
558+ exc_info = error ,
562559 )
563560
564561 async def on_modal_error (self , error : Exception , interaction : Interaction ) -> None :
565562 """|coro|
566563
567564 The default modal error handler provided by the client.
568- The default implementation prints the traceback to stderr .
565+ The default implementation logs the traceback with :meth:`logging.error` .
569566
570567 This only fires for a modal if you did not define its :func:`~discord.ui.Modal.on_error`.
571568 """
572569
573- print (f"Ignoring exception in modal { interaction .modal } :" , file = sys .stderr )
574- traceback .print_exception (
575- error .__class__ , error , error .__traceback__ , file = sys .stderr
576- )
570+ _log .error (f"Ignoring exception in modal { interaction .modal } " , exc_info = error )
571+
577572
578573 # hooks
579574
0 commit comments