heroku-cli-util
Advanced tools
Comparing version 3.2.0 to 3.4.0
@@ -28,6 +28,3 @@ 'use strict'; | ||
process.chdir(context.cwd); | ||
let handleErr = h.errorHandler({ | ||
logPath: context.herokuDir + '/error.log', | ||
stackTrace: true, | ||
}); | ||
let handleErr = h.errorHandler({logPath: context.herokuDir+'/error.log'}); | ||
let run = function () { | ||
@@ -34,0 +31,0 @@ co.wrap(fn)(context, heroku(context)) |
@@ -22,10 +22,2 @@ 'use strict'; | ||
function error (msg) { | ||
console.error(bangify(wrap(msg))); | ||
} | ||
function warn (msg) { | ||
console.error(bangify(wrap(msg))); | ||
} | ||
function getErrorMessage (err) { | ||
@@ -49,2 +41,10 @@ if (err.body) { | ||
function error (err) { | ||
console.error(bangify(wrap(getErrorMessage(err)))); | ||
} | ||
function warn (msg) { | ||
console.error(bangify(wrap(msg))); | ||
} | ||
function logtimestamp() { | ||
@@ -57,6 +57,5 @@ return new Date().toISOString() | ||
function logErr(err, logPath) { | ||
function log(msg, logPath) { | ||
let fs = require('fs'); | ||
fs.appendFileSync(logPath, logtimestamp() + ' ' + err.stack + '\n'); | ||
error(`See ${logPath}` + logPath + ' for more info.'); | ||
fs.appendFileSync(logPath, logtimestamp() + ' ' + msg + '\n'); | ||
} | ||
@@ -67,16 +66,20 @@ | ||
options = options || {}; | ||
error(getErrorMessage(err)); | ||
if (!err.body && options.stackTrace && err.stack) { | ||
if (options.logPath) { | ||
logErr(err, options.logPath); | ||
} else { | ||
console.error(err.stack); | ||
error(err); | ||
if (options.logPath) { | ||
if (err.stack) { | ||
log(err.stack, options.logPath); | ||
} | ||
if (err.body) { | ||
log(JSON.stringify(err.body), options.logPath); | ||
} | ||
//error(`See ${options.logPath} for more info.`); | ||
} | ||
process.exit(1); | ||
if (options.exit !== false) { | ||
process.exit(1); | ||
} | ||
}; | ||
} | ||
module.exports.error = error; | ||
module.exports.warn = warn; | ||
module.exports.errorHandler = errorHandler; | ||
module.exports.error = error; | ||
module.exports.warn = warn; | ||
module.exports.errorHandler = errorHandler; |
34
index.js
@@ -7,18 +7,18 @@ var console = require('./console'); | ||
exports.run = require('./run'); | ||
exports.log = console.log.bind(console); | ||
exports.formatDate = require('./date').formatDate; | ||
exports.error = errors.error; | ||
exports.warn = errors.warn; | ||
exports.errorHandler = errors.errorHandler; | ||
exports.columnify = require('./columnify'); | ||
exports.console = console; | ||
exports.prompt = prompt.prompt; | ||
exports.confirmApp = prompt.confirmApp; | ||
exports.preauth = require('./preauth'); | ||
exports.command = require('./command'); | ||
exports.defaultHost = config.defaultHost; | ||
exports.httpGitHost = config.httpGitHost; | ||
exports.gitHost = config.gitHost; | ||
exports.host = config.host; | ||
exports.action = output.action; | ||
exports.run = require('./run'); | ||
exports.log = console.log.bind(console); | ||
exports.formatDate = require('./date').formatDate; | ||
exports.error = errors.error; | ||
exports.warn = errors.warn; | ||
exports.errorHandler = errors.errorHandler; | ||
exports.columnify = require('./columnify'); | ||
exports.console = console; | ||
exports.prompt = prompt.prompt; | ||
exports.confirmApp = prompt.confirmApp; | ||
exports.preauth = require('./preauth'); | ||
exports.command = require('./command'); | ||
exports.defaultHost = config.defaultHost; | ||
exports.httpGitHost = config.httpGitHost; | ||
exports.gitHost = config.gitHost; | ||
exports.host = config.host; | ||
exports.action = output.action; |
{ | ||
"name": "heroku-cli-util", | ||
"version": "3.2.0", | ||
"version": "3.4.0", | ||
"description": "Set of helpful CLI utilities", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20276