add proper error handling because im stupid

This commit is contained in:
biglyderv 2025-02-12 00:54:08 -05:00
parent 97c440fd8b
commit e29ac278f3
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5

View file

@ -32,7 +32,14 @@ if (mode == 'cli') {
const app = e();
app.get('/top', async (req, res) => {
let json = await fetch("https://nbg.dervland.net/api/followjson.php");
json = await json.json();
try {
json = await json.json();
} catch (err) {
json = {};
res.send(JSON.stringify({}));
return;
}
let { ref } = req.query;