balena-cli/lib/errors.coffee

13 lines
268 B
CoffeeScript
Raw Normal View History

chalk = require('chalk')
errors = require('resin-cli-errors')
2014-12-22 16:47:12 +00:00
exports.handle = (error) ->
message = errors.interpret(error)
return if not message?
2014-12-22 16:47:12 +00:00
if process.env.DEBUG
message = error.stack
console.error(chalk.red(message))
process.exit(error.exitCode or 1)