balena-cli/lib/errors.coffee
Juan Cruz Viotti 904b9f07fb Highlight errors in red
- Move error translation logic to resin-io/resin-cli-errors.
- Force `process.exit()`.
2015-09-11 14:47:38 +03:00

13 lines
268 B
CoffeeScript

chalk = require('chalk')
errors = require('resin-cli-errors')
exports.handle = (error) ->
message = errors.interpret(error)
return if not message?
if process.env.DEBUG
message = error.stack
console.error(chalk.red(message))
process.exit(error.exitCode or 1)