fix: show raw PHP response in error message, clean up errores column UI

- sync_paciente: catch JSONDecodeError separately and include HTTP status
  + first 300 chars of raw response so PHP errors are visible in the log
- envios_erp.html: Errores column shows count only (not all inline messages)
  — error detail is already visible in the expandable Ver N row

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-17 09:57:45 -05:00
co-authored by Claude Sonnet 4.6
parent cd63683869
commit 6157d2c2f9
2 changed files with 12 additions and 4 deletions
+11 -1
View File
@@ -145,7 +145,17 @@ async def sync_paciente(
async with httpx.AsyncClient(timeout=15) as c:
resp = await c.post(url, json=payload, headers=headers)
data = resp.json()
try:
data = resp.json()
except Exception as json_err:
raw = resp.text[:300].strip()
return {
"ok": False,
"action": "error",
"message": f"HTTP {resp.status_code} — respuesta no JSON: {raw!r}",
"doc": payload["numero_documento"],
"nombre": payload["nombre_completo"],
}
return {
"ok": data.get("ok", False),
"action": data.get("action", ""),