Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

168
Vistas
How simulate request errors?

So, I read the article: "How to Handle API Errors"

In this article, it is proposed to divide errors into:

if (err.response) { 
      // client received an error response (5xx, 4xx)
    } else if (err.request) { 
      // client never received a response, or request never left 
    } else { 
      // anything else 
    } 

Ok, but how i can test this?

  • Response errors are pretty easy. I use Mokku chrome extension.
  • Else errors i can simulate with chrome dev tools 'network request blocking' tab.

But what about request Errors? How can i simulate this error on frontend?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

What you need is a testing framework, which could be something like Jest. Using a testing framework, you can mock the request to return an error you choose.

Heres a post with an answer which might be the same as your issue.

Mock Axios to test .catch()

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda