Merge pull request #1529 from benphelps/fix/issue-1527

Fix: Add try catch for ping
This commit is contained in:
shamoon 2023-05-20 09:49:36 -07:00 committed by GitHub
commit a59e8e6efd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,7 @@ export default async function handler(req, res) {
});
}
try {
let startTime = performance.now();
let [status] = await httpProxy(pingURL, {
method: "HEAD"
@ -32,4 +33,10 @@ export default async function handler(req, res) {
status,
latency: endTime - startTime
});
} catch (e) {
logger.debug("Error attempting ping: %s", JSON.stringify(e));
return res.status(400).send({
error: 'Error attempting ping, see logs.',
});
}
}