From d3e87eef44ed0df46188184da5bcebf0d2421130 Mon Sep 17 00:00:00 2001 From: kshitij <82637225+kshitijk4poor@users.noreply.github.com> Date: Mon, 10 Aug 2026 10:53:57 +0530 Subject: [PATCH] refactor: drop dead sys.exc_info check in delivery error log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The result-error path in _deliver_result is not inside an except block, so sys.exc_info() always returns (None, None, None) — the condition was always False. Simplify to a plain logger.error call with accurate comment. --- cron/scheduler.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cron/scheduler.py b/cron/scheduler.py index b9ce3c55d5..0102f1f643 100644 --- a/cron/scheduler.py +++ b/cron/scheduler.py @@ -2231,11 +2231,11 @@ def _deliver_result(job: dict, content: str, adapters=None, loop=None) -> Option if result and result.get("error"): # Include target context (platform/chat) so a bare error string - # like "Discord send failed: TimeoutError: " is attributable; - # no active exception here (error comes from the send result), - # so exc_info is only attached when one is in flight. + # like "Discord send failed: TimeoutError: " is attributable. + # Not inside an except block — the error comes from the send + # result dict, so there is no traceback to attach. msg = f"delivery error: {result['error']} (target {platform_name}:{chat_id})" - logger.error("Job '%s': %s", job["id"], msg, exc_info=sys.exc_info()[0] is not None) + logger.error("Job '%s': %s", job["id"], msg) target_errors.extend([msg]) delivery_errors.extend(target_errors) continue