mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-20 13:32:43 +08:00
26 lines
626 B
JavaScript
26 lines
626 B
JavaScript
'use strict';
|
|
var chalk = require('chalk');
|
|
|
|
module.exports = function writeError(ui, error) {
|
|
if (!error) { return; }
|
|
|
|
// Uglify errors have a filename instead
|
|
var fileName = error.file || error.filename;
|
|
if (fileName) {
|
|
if (error.line) {
|
|
fileName += error.col ? ' (' + error.line + ':' + error.col + ')' : ' (' + error.line + ')';
|
|
}
|
|
ui.writeLine(chalk.red('File: ' + fileName), 'ERROR');
|
|
}
|
|
|
|
if (error.message) {
|
|
ui.writeLine(chalk.red(error.message), 'ERROR');
|
|
} else {
|
|
ui.writeLine(chalk.red(error), 'ERROR');
|
|
}
|
|
|
|
if (error.stack) {
|
|
ui.writeLine(error.stack, 'ERROR');
|
|
}
|
|
};
|