Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

420
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!