balena-cli/build/errors.js
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

22 lines
416 B
JavaScript

(function() {
var chalk, errors;
chalk = require('chalk');
errors = require('resin-cli-errors');
exports.handle = function(error) {
var message;
message = errors.interpret(error);
if (message == null) {
return;
}
if (process.env.DEBUG) {
message = error.stack;
}
console.error(chalk.red(message));
return process.exit(error.exitCode || 1);
};
}).call(this);