Explorar el Código

add try catch

ryohi15 hace 5 años
padre
commit
a1fbe91c63
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  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({});
     }
     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;