diff --git a/app/js/DockerRunner.js b/app/js/DockerRunner.js index 393ce3d..3594b3a 100644 --- a/app/js/DockerRunner.js +++ b/app/js/DockerRunner.js @@ -99,11 +99,7 @@ module.exports = DockerRunner = { error, output ) { - if ( - __guard__(error != null ? error.message : undefined, x => - x.match('HTTP code is 500') - ) - ) { + if (error && error.statusCode === 500) { logger.log( { err: error, project_id }, 'error running container so destroying and retrying' diff --git a/test/unit/js/DockerRunnerTests.js b/test/unit/js/DockerRunnerTests.js index eea66b1..8399283 100644 --- a/test/unit/js/DockerRunnerTests.js +++ b/test/unit/js/DockerRunnerTests.js @@ -202,9 +202,9 @@ describe('DockerRunner', function() { } if (firstTime) { firstTime = false - return callback( - new Error('HTTP code is 500 which indicates error: server error') - ) + const error = new Error('(HTTP code 500) server error - ...') + error.statusCode = 500 + return callback(error) } else { return callback(null, this.output) }