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

212
Views
intente atrapar, no atrapar fetch () 502 excepción de puerta de enlace

Por alguna razón, cada vez que hay una URL no válida que provoca una excepción 502, el código arroja un error en la consola y se rompe. Ignorando el intento {} catch{}

 async function getHeight(url) { const serviceUrl = url try { const request = fetch(Proxy+"http://"+url+"/v1/query/height", { method: "post", headers: { "Content-Type": "application/json" }, }); return [serviceUrl, request] } catch { return [serviceUrl, "failed"] } }
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Me encontré con esto antes y parece que el navegador falla. Pero deberías poder atraparlo. Pruébalo de esta manera.

 try { } catch(error) { if (!error.response){ return [serviceUrl, "No server response."] } else if (error.response.status === 502) { return [serviceUrl, "Bad gateway"] } else { [serviceUrl, "Server unable to process request."] } }
about 4 years ago · Santiago Trujillo Report
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!