mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-15 17:30:30 +00:00
Merge pull request #1529 from benphelps/fix/issue-1527
Fix: Add try catch for ping
This commit is contained in:
commit
a59e8e6efd
1 changed files with 24 additions and 17 deletions
|
@ -15,6 +15,7 @@ export default async function handler(req, res) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
let startTime = performance.now();
|
let startTime = performance.now();
|
||||||
let [status] = await httpProxy(pingURL, {
|
let [status] = await httpProxy(pingURL, {
|
||||||
method: "HEAD"
|
method: "HEAD"
|
||||||
|
@ -32,4 +33,10 @@ export default async function handler(req, res) {
|
||||||
status,
|
status,
|
||||||
latency: endTime - startTime
|
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.',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue