@@ -536,11 +536,11 @@ async def on_error(self, event_method: str, *args: Any, **kwargs: Any) -> None:
536
536
537
537
The default error handler provided by the client.
538
538
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
540
540
overridden to have a different implementation.
541
541
Check :func:`~discord.on_error` for more details.
542
542
"""
543
- print (f"Ignoring exception in { event_method } " , file = sys . stderr )
543
+ _log . error (f"Ignoring exception in { event_method } " )
544
544
traceback .print_exc ()
545
545
546
546
async def on_view_error (
@@ -553,27 +553,22 @@ async def on_view_error(
553
553
This only fires for a view if you did not define its :func:`~discord.ui.View.on_error`.
554
554
"""
555
555
556
- print (
556
+ _log . error (
557
557
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 ,
562
559
)
563
560
564
561
async def on_modal_error (self , error : Exception , interaction : Interaction ) -> None :
565
562
"""|coro|
566
563
567
564
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` .
569
566
570
567
This only fires for a modal if you did not define its :func:`~discord.ui.Modal.on_error`.
571
568
"""
572
569
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
+
577
572
578
573
# hooks
579
574
0 commit comments