Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit fe06f53

Browse files
committed
refactor(lint): provide error messages
1 parent 1832907 commit fe06f53

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/lint.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { lintFile, LintResult, processLintResults } from './lint/lint-utils';
55
import { createProgram, getFileNames } from './lint/lint-factory';
66
import { getUserConfigFile } from './util/config';
77
import * as Constants from './util/constants';
8+
import { BuildError } from './util/errors';
89
import { getBooleanPropertyValue } from './util/helpers';
910
import { join } from 'path';
1011
import { Logger } from './logger/logger';
@@ -19,9 +20,9 @@ export function lint(context: BuildContext, configFile?: string) {
1920
.then(() => {
2021
logger.finish();
2122
})
22-
.catch(err => {
23+
.catch((err: Error) => {
2324
if (getBooleanPropertyValue(Constants.ENV_BAIL_ON_LINT_ERROR)) {
24-
throw logger.fail(err);
25+
throw logger.fail(new BuildError(err));
2526
}
2627
logger.finish();
2728
});
@@ -90,12 +91,12 @@ function getLintConfig(context: BuildContext, configFile: string): Promise<strin
9091

9192
Logger.debug(`tslint config: ${configFile}`);
9293

93-
access(configFile, (err) => {
94+
access(configFile, (err: Error) => {
9495
if (err) {
9596
// if the tslint.json file cannot be found that's fine, the
9697
// dev may not want to run tslint at all and to do that they
9798
// just don't have the file
98-
reject();
99+
reject(err);
99100
return;
100101
}
101102
resolve(configFile);

0 commit comments

Comments
 (0)