fix(cron): surface exception type and traceback for standalone Discord delivery errors
This commit is contained in:
parent
b1663edf2a
commit
100219f664
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Reference in New Issue