Skip to content

The agent that grows with you

fix(cron): surface exception type and traceback for standalone Discord delivery errors

aameobius100219f66436
diff --git a/cron/scheduler.py b/cron/scheduler.py
index 0177b278f92..b9ce3c55d58 100644
--- a/cron/scheduler.py
+++ b/cron/scheduler.py
@@ -2230,8 +2230,12 @@ def _deliver_result(job: dict, content: str, adapters=None, loop=None) -> Option
continue
if result and result.get("error"):
- msg = f"delivery error: {result['error']}"
- logger.error("Job '%s': %s", job["id"], msg)
+ # 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.
+ 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)
target_errors.extend([msg])
delivery_errors.extend(target_errors)
continue
diff --git a/plugins/platforms/discord/adapter.py b/plugins/platforms/discord/adapter.py
index cd3b2b0166d..10d2e32cd42 100644
--- a/plugins/platforms/discord/adapter.py
+++ b/plugins/platforms/discord/adapter.py
@@ -9805,7 +9805,10 @@ async def _standalone_send(
result["warnings"] = warnings
return result
except Exception as e:
- return {"error": _standalone_sanitize_error(f"Discord send failed: {e}")}
+ # Include the exception type: TimeoutError().str() is empty, so
+ # "Discord send failed: " alone gave no diagnostic signal.
+ logger.error("Discord standalone send failed", exc_info=True)
+ return {"error": _standalone_sanitize_error(f"Discord send failed: {type(e).__name__}: {e}")}
# ── Plugin entry point ────────────────────────────────────────────────────────