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

432
Visualizações
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 à 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