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", ""),
+1 -3
View File
@@ -311,9 +311,7 @@ async function cargarHistorialScheduler() {
<td class="py-2 pr-3 text-right text-blue-600 font-medium">${r.created}</td>
<td class="py-2 pr-3 text-right text-green-600">${r.updated}</td>
<td class="py-2 pr-3 text-right ${r.errores > 0 ? 'text-red-500 font-medium' : 'text-gray-300'}">
${r.errores > 0 && errDet.length
? errDet.map(e => `<div class="text-red-600 text-xs">${e.doc}${e.msg}</div>`).join('')
: r.errores || '—'}
${r.errores || '—'}
</td>
<td class="py-2 text-right">
${pacientes.length ? `