add proper error handling because im stupid
This commit is contained in:
parent
97c440fd8b
commit
e29ac278f3
1 changed files with 8 additions and 1 deletions
9
index.js
9
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue