26 if (res.locals.avatar) {
27 try {
28 unlinkSync(avatars + res.locals.avatar);
29 } catch(ignored){} 30 }
31 let filename = genstring(95) + ".webp";
32 while (existsSync(avatars + "/" + filename) || filename === ".webp") { //generate new filename until it's unique
38 res.status(401);
39 res.json({ "error": "Bad auth cookie set" });
40 }
41 catch (ignored) { } //sometimes it errors, gotta debug soon42 return false;
43 }
44 return decodeURIComponent(unsigned);
Empty block statements, while not technically errors, usually occur due to refactoring that wasn't completed. They can mislead the reader.
If you still want to keep an empty block, add a comment saying empty
inside the block.
if (someCheck) {}
while (someCheck) {}
try {
doSomething();
} catch(err) {
} finally {
}
if (someCheck) {
// empty
}
while (someCheck) {
/* empty */
}
try {
doSomething();
} catch (err) {
// continue regardless of error
}
try {
doSomething();
} finally {
/* continue regardless of error */
}