This commit is contained in:
Luiz Silva 2024-10-02 14:34:15 -03:00
parent d0808a86dc
commit ef9b4c746c
4 changed files with 33 additions and 4 deletions

View file

@ -148,7 +148,16 @@ class ClassPilao {
body: JSON.stringify({ tabela, registros: bloco }),
headers: { "Content-Type": "application/json" },
})
.then((r) => r.json())
.then(async (r) => {
try {
return await r.json()
} catch {
return respostaComuns.erro("Consulta não retornou json válido", [
await r.text(),
r.statusText,
])
}
})
.catch((e) =>
respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]),
)