Explorar el Código

add error handling

Yuki Takei hace 6 años
padre
commit
898ba4a258
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      src/server/routes/admin.js

+ 6 - 1
src/server/routes/admin.js

@@ -1152,7 +1152,12 @@ module.exports = function(crowi, app) {
       return res.json(ApiResponse.error('ElasticSearch Integration is not set up.'));
       return res.json(ApiResponse.error('ElasticSearch Integration is not set up.'));
     }
     }
 
 
-    await search.buildIndex();
+    try {
+      await search.buildIndex();
+    }
+    catch (err) {
+      return res.json(ApiResponse.error(err));
+    }
 
 
     return res.json(ApiResponse.success());
     return res.json(ApiResponse.success());
   };
   };