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

@ -111,7 +111,17 @@ 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 p_respostas_1.respostaComuns.erro("Consulta não retornou json válido", [
await r.text(),
r.statusText,
]);
}
})
.catch((e) => p_respostas_1.respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]));
if (resp.eErro)
return resp;