From 5095953257694b0c19ecbdbb9724b364b65af9a8 Mon Sep 17 00:00:00 2001 From: disqualifier Date: Sun, 9 Aug 2026 02:13:12 -0400 Subject: [PATCH] fix: drop exc_info on the best-effort cleanup warnings cache_button refresh and on_timeout delete are best-effort cleanup that swallow the HTTPException and recover; both logged at WARNING with exc_info=True, dumping a full traceback on a handled-and-recovered path. exc_info belongs on terminal/unhandled paths - drop it and fold the exception reason in with %s so the diagnostic is kept without the traceback noise. Signed-off-by: disqualifier --- src/dpy_paginator/dpy_paginator.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dpy_paginator/dpy_paginator.py b/src/dpy_paginator/dpy_paginator.py index f105c6d..b5b27a8 100644 --- a/src/dpy_paginator/dpy_paginator.py +++ b/src/dpy_paginator/dpy_paginator.py @@ -385,8 +385,10 @@ class DPYPaginator(Generic[PageT_co], discord.ui.View): await self.message.edit(**kwargs) except (discord.NotFound, discord.Forbidden): pass - except discord.HTTPException: - log.warning("paginator cache_button: failed to refresh message", exc_info=True) + except discord.HTTPException as exc: + # swallowed best-effort cleanup that recovers - no traceback (exc_info belongs + # on terminal/unhandled paths); the reason is folded in for diagnosis. + log.warning("paginator cache_button: failed to refresh message: %s", exc) @discord.ui.button(style=discord.ButtonStyle.blurple) async def next_page(self, interaction: Interaction, _: discord.ui.Button[Self]) -> None: @@ -464,9 +466,10 @@ class DPYPaginator(Generic[PageT_co], discord.ui.View): await self.message.delete() except (discord.NotFound, discord.Forbidden): pass - except discord.HTTPException: - # best-effort cleanup task; log rather than raise into an unretrieved task - log.warning("paginator on_timeout: failed to delete message", exc_info=True) + except discord.HTTPException as exc: + # best-effort cleanup task; log rather than raise into an unretrieved task. no + # traceback (exc_info belongs on terminal/unhandled paths) - fold the reason in. + log.warning("paginator on_timeout: failed to delete message: %s", exc) # back-compat alias: the class was originally named ButtonPaginator; DPYPaginator is