Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro no catch block

Esse é o error q aparece no console:

(node:16808) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:8082 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) (Use node --trace-warnings ... to show where the warning was created) (node:16808) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:16808) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

E aqui o cod

buscaPorId(id, res) {
        const sql = `SELECT * FROM Atendimentos WHERE id=${id}`

        conexao.query(sql, async (erro, resultados) => {
            const atendimento = resultados[0]
            const cpf = atendimento.cliente
            if (erro) {
                res.status(400).json(erro)
            } else {
                const data = await axios.get(`http://localhost:8082/${cpf}`)

                atendimento.cliente = data

                res.status(200).json(atendimento)
            }
        })
    }

Gostaria de saber como q faço para debuggar esse erro

1 resposta
solução!

tópico resolvido