From e29ac278f3b2522e4e899ac195c84a609fda4625 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Wed, 12 Feb 2025 00:54:08 -0500 Subject: [PATCH] add proper error handling because im stupid --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c94470c..b785332 100644 --- a/index.js +++ b/index.js @@ -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;