Skip to content

Commit

Permalink
Use console.log instead of .error
Browse files Browse the repository at this point in the history
Those errors are not failures of gulp-typescript
  • Loading branch information
ivogabe committed Jan 10, 2018
1 parent 67d8963 commit 0b3d85c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export class FileCompiler implements ICompiler {

const start = '//# sourceMappingURL=data:application/json;base64,';
if (mapString.substring(0, start.length) !== start) {
console.error('Couldn\'t read the sourceMap generated by TypeScript. This is likely an issue with gulp-typescript.');
console.log('Couldn\'t read the sourceMap generated by TypeScript. This is likely an issue with gulp-typescript.');
return;
}

Expand Down
12 changes: 6 additions & 6 deletions lib/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function nullReporter(): Reporter {
export function defaultReporter(): Reporter {
return {
error: (error: TypeScriptError) => {
console.error(error.message);
console.log(error.message);
},
finish: defaultFinishHandler
};
Expand All @@ -98,11 +98,11 @@ export function longReporter(): Reporter {
return {
error: (error: TypeScriptError) => {
if (error.tsFile) {
console.error('[' + colors.gray('gulp-typescript') + '] ' + colors.red(error.fullFilename
console.log('[' + colors.gray('gulp-typescript') + '] ' + colors.red(error.fullFilename
+ '(' + error.startPosition.line + ',' + error.startPosition.character + '): ')
+ 'error TS' + error.diagnostic.code + ' ' + typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n'));
} else {
console.error(error.message);
console.log(error.message);
}
},
finish: defaultFinishHandler
Expand All @@ -111,19 +111,19 @@ export function longReporter(): Reporter {
export function fullReporter(fullFilename: boolean = false): Reporter {
return {
error: (error: TypeScriptError, typescript: typeof ts) => {
console.error('[' + colors.gray('gulp-typescript') + '] '
console.log('[' + colors.gray('gulp-typescript') + '] '
+ colors.bgred(error.diagnostic.code + '')
+ ' ' + colors.red(typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n'))
);

if (error.tsFile) {
console.error('> ' + colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + colors.gray(':'));
console.log('> ' + colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + colors.gray(':'));
const lines = error.tsFile.text.split(/(?:\r\n|\r|\n)/);

const logLine = (lineIndex: number, errorStart: number, errorEnd?: number) => {
const line = lines[lineIndex];
if (errorEnd === undefined) errorEnd = line.length;
console.error('> ' + colors.gray('[' + lineIndex + '] ')
console.log('> ' + colors.gray('[' + lineIndex + '] ')
+ line.substring(0, errorStart)
+ colors.red(line.substring(errorStart, errorEnd))
+ line.substring(errorEnd)
Expand Down

0 comments on commit 0b3d85c

Please sign in to comment.