From 951d369e3fe0d3dffb866bfbdc62c2b536818036 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Mon, 12 Apr 2021 17:30:05 -0400 Subject: [PATCH] padaccess: Delete useless try/catch --- src/node/padaccess.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/node/padaccess.js b/src/node/padaccess.js index 5ca5641b5..e9cc7cde5 100644 --- a/src/node/padaccess.js +++ b/src/node/padaccess.js @@ -3,21 +3,16 @@ const securityManager = require('./db/SecurityManager'); // checks for padAccess module.exports = async (req, res) => { - try { - const {session: {user} = {}} = req; - const accessObj = await securityManager.checkAccess( - req.params.pad, req.cookies.sessionID, req.cookies.token, user); + const {session: {user} = {}} = req; + const accessObj = await securityManager.checkAccess( + req.params.pad, req.cookies.sessionID, req.cookies.token, user); - if (accessObj.accessStatus === 'grant') { - // there is access, continue - return true; - } else { - // no access - res.status(403).send("403 - Can't touch this"); - return false; - } - } catch (err) { - // @TODO - send internal server error here? - throw err; + if (accessObj.accessStatus === 'grant') { + // there is access, continue + return true; + } else { + // no access + res.status(403).send("403 - Can't touch this"); + return false; } };