balena-cli/lib/errors.coffee

14 lines
309 B
CoffeeScript
Raw Normal View History

chalk = require('chalk')
errors = require('resin-cli-errors')
patterns = require('./utils/patterns')
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
patterns.printErrorMessage(message)
process.exit(error.exitCode or 1)