diff --git a/server/ftp-integration/taggedXML.js b/server/ftp-integration/taggedXML.js index d9ddbca0e68b094324e722edc1cc16c65f7678a7..e48fd8623ab500c2ec07044c88b7afbc1dfde585 100644 --- a/server/ftp-integration/taggedXML.js +++ b/server/ftp-integration/taggedXML.js @@ -39,13 +39,17 @@ const watcher = chokidar.watch(`${rootPath}**/*.tar.gz`, { }, }) -process.on('uncaughtException', err => { - if (err.submitter) { - bulkUploaderEmail(err.submitter.email, err.message) - } - errorDevEmail(err) - logger.error('whoops! there was an error', err.stack) -}) +process + .on('uncaughtException', err => { + if (err.submitter) { + bulkUploaderEmail(err.submitter.email, err.message) + } + errorDevEmail(err) + logger.error('whoops! there was an error', err.stack) + }) + .on('unhandledRejection', reason => { + logger.error(`Unhandled Rejection at: ${reason.stack || reason}`) + }) watcher .on('add', path => logger.debug(`File ${path} has been added.`)) diff --git a/server/ftp-integration/toTaggers.js b/server/ftp-integration/toTaggers.js index 32b117d9d97cacae20a40a8ee5ff54e3fcfc87a7..f982a465150eab6660e7e8f96ae53368b7801c01 100755 --- a/server/ftp-integration/toTaggers.js +++ b/server/ftp-integration/toTaggers.js @@ -298,11 +298,15 @@ function compress(tmpPath, manuscript, datedFolder) { }) } -process.on('uncaughtException', err => { - errorDevEmail(err) - logger.error('whoops! there was an error', err.stack) - // tidyUp() -}) +process + .on('uncaughtException', err => { + errorDevEmail(err) + logger.error('whoops! there was an error', err.stack) + // tidyUp() + }) + .on('unhandledRejection', reason => { + logger.error(`Unhandled Rejection at: ${reason.stack || reason}`) + }) function tidyUp(tmpPath) { try { diff --git a/server/utils/files.js b/server/utils/files.js index 86411009b73aaaf87e543ce596c3f6b01946a118..5d67d88274a6cc61f680d92bc6d4d0b8c296cda7 100644 --- a/server/utils/files.js +++ b/server/utils/files.js @@ -131,7 +131,6 @@ module.exports.moveErroneousFile = function moveErroneousFile( ) { return new Promise((resolve, reject) => { const filename = path.basename(filepath) - const oldPath = filepath const newPath = `${errorFolder}/${filename}_${Date.now()}`