Added protection against unhandledRejections on compatdb import.
This commit is contained in:
		| @@ -22,6 +22,12 @@ const fsPathHugoIcon = '../../site/static/images/game/icons'; | |||||||
| const fsPathHugoScreenshots = '../../site/static/images/screenshots0'; | const fsPathHugoScreenshots = '../../site/static/images/screenshots0'; | ||||||
| const fsPathHugoSavefiles = '../../site/static/savefiles/'; | const fsPathHugoSavefiles = '../../site/static/savefiles/'; | ||||||
|  |  | ||||||
|  | process.on('unhandledRejection', err => { | ||||||
|  |   logger.error('Unhandled rejection on process.'); | ||||||
|  |   logger.error(err); | ||||||
|  |   process.exit(1); | ||||||
|  | }); | ||||||
|  |  | ||||||
| function gitPull(directory, repository) { | function gitPull(directory, repository) { | ||||||
|   if (fs.existsSync(directory)) { |   if (fs.existsSync(directory)) { | ||||||
|       logger.info(`Fetching latest from Github : ${directory}`); |       logger.info(`Fetching latest from Github : ${directory}`); | ||||||
| @@ -115,8 +121,7 @@ setup().then(function() { | |||||||
|         fs.mkdirSync(path); |         fs.mkdirSync(path); | ||||||
|     } |     } | ||||||
|   }); |   }); | ||||||
| }) | }).then(function() { | ||||||
| .then(function() { |  | ||||||
|   // Transform wiki entries to lowercase |   // Transform wiki entries to lowercase | ||||||
|   const files = fs.readdirSync(fsPathWiki); |   const files = fs.readdirSync(fsPathWiki); | ||||||
|  |  | ||||||
| @@ -129,9 +134,9 @@ setup().then(function() { | |||||||
|   getDirectories(fsPathCode).forEach(function(game) { |   getDirectories(fsPathCode).forEach(function(game) { | ||||||
|     processGame(game); |     processGame(game); | ||||||
|   }); |   }); | ||||||
| }) | }).catch(function(err) { | ||||||
| .catch(function(err) { |  | ||||||
|   logger.error(err); |   logger.error(err); | ||||||
|  |   process.exit(1); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| function processGame(game) { | function processGame(game) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user