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

423
Vistas
How to handle/intercept net::ERR_HTTP2_PROTOCOL_ERROR 200

Dear experienced developers I'd really appreciate help with the following.

When running the code below [Chrome Version 100.0.4896.127 (Official Build) (arm64), macOS Monterey Version 12.3] from time to time (intermittently) I get the following error:

net::ERR_HTTP2_PROTOCOL_ERROR 200

and execution stops.

<!DOCTYPE html>
<html>
<head>

<style>

</style>
</head>
<body>

<script>

function sleep(milliseconds) 
{
  const date = Date.now();
  let currentDate = null;
  do {
    currentDate = Date.now();
  } while (currentDate - date < milliseconds);
}

async function doIt() 
{
    while(true)
    {
        for (let i = 1; i < 7; i++)
        {

            let response = await fetch("court"+i+".txt", {cache: "no-store"});
        
            let contents = await response.text();
            let components = contents.split(";");

            let CourtActive = components[0];
            let CourtName = components[1];
            let CourtLastUpdate = components [2]; 
            console.log(CourtActive);
            console.log(CourtName);
            console.log(CourtLastUpdate);
        }
        sleep(1000);
    }
}
    doIt();
    
</script>

</body>
</html>

The contents of courtX.txt is uploaded to the server through ftp and looks like this:

1;CourtX;0

I suspect the error happens when the fetch is executed just when the file is being updated and for some reason Chrome doesn't handle it properly (the error doesn't happens when I use Safari). So my question is how can I intercept the error (try, catch doesn't do it) in such a way that I will only go to the fetch statement if I'm sure the file is stable.

Hope I made myself clear enough and many thanks in advance for any hints.

about 4 years ago · Juan Pablo Isaza
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