Merge pull request #1 from Enstrayed/main

merge upstream improvements into etyd-refactor
This commit was merged in pull request #1.
This commit is contained in:
Nathan Ritchie
2024-06-12 12:57:50 -07:00
committed by GitHub
3 changed files with 55 additions and 38 deletions

View File

@@ -10,7 +10,12 @@ app.get("/etyd*", (rreq,rres) => {
rres.sendStatus(404)
} else {
dbRes.json().then(dbRes => {
rres.redirect(dbRes.content.url)
try {
rres.redirect(dbRes.content.url) // Node will crash if the Database entry is malformed
} catch (responseError) {
rres.sendStatus(500)
console.log(`${rres.get("cf-connecting-ip")} GET ${rreq.path} returned 500: ${responseError}`)
}
})
}
}).catch(fetchError => {