Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

288
Visualizações
Seeing error message from network tab, but not in the try/catch console.log(error)

I am working on the front-end part of a project, and the backend is done, basically when a condition is met, the backend will send 409 conflict and a specific error message, and my job is to capture that error message and let that to be displayed on the front-end.

But I couldn't get the error message in the try-catch block, and only seeing the error message in the Network tab of Chrome.

Here's my try-catch front end code

try{
            const response = await this.request({
                path: `/api/xxx/xxx/{xxx}/xx`.replace(`{${"xxx"}}`, xx(String(requestParameters.terminalId))),
                method: 'PUT',
                headers: headerParameters,
                query: queryParameters,
                body: UpdateTerminalDataPortRequestDtoToJSON(requestParameters.updateTerminalDataPortRequestDto),
            }, initOverrides);
        }
        catch(e){
            console.log("error message")
            console.error(e)
        }

and here is what the Network Tab enter image description here

and here is what the console log error look like: enter image description here

How can I get the same error message as the one showing in the Networks?

Thanks in advance....any comment would be appreciated

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Solved it by accessing err.response through catch

.catch(function (err) {
    console.log(err.response)
})
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda