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:
co-authored by
Claude Sonnet 4.6
parent
cd63683869
commit
6157d2c2f9
@@ -145,7 +145,17 @@ async def sync_paciente(
|
|||||||
async with httpx.AsyncClient(timeout=15) as c:
|
async with httpx.AsyncClient(timeout=15) as c:
|
||||||
resp = await c.post(url, json=payload, headers=headers)
|
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 {
|
return {
|
||||||
"ok": data.get("ok", False),
|
"ok": data.get("ok", False),
|
||||||
"action": data.get("action", ""),
|
"action": data.get("action", ""),
|
||||||
|
|||||||
@@ -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-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 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'}">
|
<td class="py-2 pr-3 text-right ${r.errores > 0 ? 'text-red-500 font-medium' : 'text-gray-300'}">
|
||||||
${r.errores > 0 && errDet.length
|
${r.errores || '—'}
|
||||||
? errDet.map(e => `<div class="text-red-600 text-xs">${e.doc} — ${e.msg}</div>`).join('')
|
|
||||||
: r.errores || '—'}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="py-2 text-right">
|
<td class="py-2 text-right">
|
||||||
${pacientes.length ? `
|
${pacientes.length ? `
|
||||||
|
|||||||
Reference in New Issue
Block a user