瀏覽代碼

add try catch

ryohi15 5 年之前
父節點
當前提交
a1fbe91c63
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      src/server/routes/apiv3/growi-cloud.js

+ 7 - 2
src/server/routes/apiv3/growi-cloud.js

@@ -12,8 +12,13 @@ module.exports = (crowi) => {
       return res.json({});
       return res.json({});
     }
     }
     const url = new URL('_api/staffCredit', growiCloudUri);
     const url = new URL('_api/staffCredit', growiCloudUri);
-    const gcContributorsRes = await axios.get(url.toString());
-    return res.apiv3(gcContributorsRes.data);
+    try {
+      const gcContributorsRes = await axios.get(url.toString());
+      return res.apiv3(gcContributorsRes.data);
+    }
+    catch(err) {
+      return res.apiv3Err(err, 500);
+    }
   });
   });
 
 
   return router;
   return router;