mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-30 10:38:50 +00:00
904b9f07fb
- Move error translation logic to resin-io/resin-cli-errors. - Force `process.exit()`.
22 lines
416 B
JavaScript
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);
|