diff --git a/bin/now-deploy.js b/bin/now-deploy.js index 2173fcb..0a5bf9f 100755 --- a/bin/now-deploy.js +++ b/bin/now-deploy.js @@ -29,6 +29,7 @@ const checkPath = require('../lib/utils/check-path') const {reAlias, assignAlias} = require('../lib/re-alias') const exit = require('../lib/utils/exit') const logo = require('../lib/utils/output/logo') +const cmd = require('../lib/utils/output/cmd') const argv = minimist(process.argv.slice(2), { string: [ @@ -587,9 +588,13 @@ function printLogs(host, token) { // log build const logger = new Logger(host, {debug, quiet}) - logger.on('error', async () => { + logger.on('error', async err => { if (!quiet) { - console.log(`${chalk.cyan('> Deployment failed!')}`) + if (err && err.type === 'BUILD_ERROR') { + error(`The build step of your project failed. To retry, run ${cmd('now --force')}.`) + } else { + error('Deployment failed') + } } if (gitRepo && gitRepo.cleanup) { diff --git a/lib/build-logger.js b/lib/build-logger.js index fcdfffd..df11a5d 100644 --- a/lib/build-logger.js +++ b/lib/build-logger.js @@ -50,6 +50,7 @@ module.exports = class Logger extends EventEmitter { } onState(state) { + // console.log(state) if (!state.id) { console.error('> Deployment not found') this.emit('error') @@ -57,7 +58,7 @@ module.exports = class Logger extends EventEmitter { } if (state.error) { - this.emit('error') + this.emit('error', state) return }