Explorar el Código

move if block to outside of try block

ryuichi-e hace 5 años
padre
commit
eb0cf6c5ff
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      src/server/routes/apiv3/bookmarks.js

+ 3 - 3
src/server/routes/apiv3/bookmarks.js

@@ -150,10 +150,10 @@ module.exports = (crowi) => {
   router.get('/:userId', accessTokenParser, loginRequired, validator.myBookmarkList, apiV3FormValidator, async(req, res) => {
     const { userId } = req.params;
     const { page, limit, offset } = req.query;
+    if (userId == null) {
+      return res.apiv3Err('User id is not found or forbidden', 400);
+    }
     try {
-      if (userId == null) {
-        return res.apiv3Err('User id is not found or forbidden', 400);
-      }
       const paginationResult = await Bookmark.paginate(
         {
           user: { $in: userId },