Przeglądaj źródła

success to show logs in import.js

kaori-t 5 lat temu
rodzic
commit
840a980452
2 zmienionych plików z 10 dodań i 1 usunięć
  1. 6 0
      src/server/routes/apiv3/import.js
  2. 4 1
      src/server/service/import.js

+ 6 - 0
src/server/routes/apiv3/import.js

@@ -160,6 +160,12 @@ module.exports = (crowi) => {
       return res.apiv3(status);
     }
     catch (err) {
+      console.log(`errSSS = ${err}`);
+      if (err.message === 'the version of this growi and the growi that exported the data are not met') {
+        const varidationErr = 'versions-are-not-met!!!!';
+        console.log('versions-are-not-met!!!!');
+        return res.apiv3Err(new ErrorV3(err.message, varidationErr), 500);
+      }
       return res.apiv3Err(err, 500);
     }
   });

+ 4 - 1
src/server/service/import.js

@@ -133,7 +133,10 @@ class ImportService {
     const zipFileStats = [];
     const parseZipFilePromises = zipFiles.map((file) => {
       const zipFile = this.getFile(file);
-      return this.growiBridgeService.parseZipFile(zipFile);
+      // return this.growiBridgeService.parseZipFile(zipFile);
+      const parsedZipfile =  this.growiBridgeService.parseZipFile(zipFile);
+      this.validate(parsedZipfile);
+      return parsedZipfile
     });
     for await (const stat of parseZipFilePromises) {
       zipFileStats.push(stat);