For some reason, whenever there is an invalid URL that causes a 502 exception, the code throws an error in the console and breaks. Ignoring the try {} 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"]
}
}
Ran into this before and it appears the browser errors it out. But you should be able to catch it. Try it this way.
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."] }
}