From 90dedb70a1bccac7d924f3764c8a224ec687837a Mon Sep 17 00:00:00 2001 From: chris062689 Date: Wed, 21 Mar 2018 22:54:47 -0400 Subject: [PATCH] Added protection against unhandledRejections on compatdb import. --- scripts/games/app.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/games/app.js b/scripts/games/app.js index 889c727..cb8ad4c 100644 --- a/scripts/games/app.js +++ b/scripts/games/app.js @@ -22,6 +22,12 @@ const fsPathHugoIcon = '../../site/static/images/game/icons'; const fsPathHugoScreenshots = '../../site/static/images/screenshots0'; 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) { if (fs.existsSync(directory)) { logger.info(`Fetching latest from Github : ${directory}`); @@ -115,8 +121,7 @@ setup().then(function() { fs.mkdirSync(path); } }); -}) -.then(function() { +}).then(function() { // Transform wiki entries to lowercase const files = fs.readdirSync(fsPathWiki); @@ -129,9 +134,9 @@ setup().then(function() { getDirectories(fsPathCode).forEach(function(game) { processGame(game); }); -}) -.catch(function(err) { +}).catch(function(err) { logger.error(err); + process.exit(1); }); function processGame(game) {