add clearer error status codes

This commit is contained in:
Mystikfluu
2022-09-10 17:32:43 +02:00
parent cf9a819a55
commit a763bde1f8
8 changed files with 75 additions and 35 deletions
+2 -2
View File
@@ -26,14 +26,14 @@ function unsign(text, req, res) {
function getunsigned(req, res) {
let cookie = req.cookies.AUTH_COOKIE;
if (!cookie) {
res.status(400);
res.status(403);
res.json({ "error": "you are not logged in! (no cookie)" });
return;
}
let unsigned = unsign(cookie, req, res);
if (!unsigned) {
try {
res.status(400);
res.status(402);
res.json({ "error": "Bad auth cookie set" });
}
catch (ignored) { } //sometimes it errors, gotta debug soon