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

Commit 683d4b2

Browse files
committed
fix(): proper exception handling in some edge cases users were encountering
1 parent 433150b commit 683d4b2

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

src/lint.ts

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,16 @@ export function lint(context?: BuildContext, configFile?: string) {
2222

2323

2424
export function lintWorker(context: BuildContext, configFile: string) {
25+
const logger = new Logger('lint');
2526
return getLintConfig(context, configFile).then(configFile => {
2627
// there's a valid tslint config, let's continue
27-
const logger = new Logger('lint');
28-
29-
return lintApp(context, configFile)
30-
.then(() => {
31-
// always finish and resolve
32-
logger.finish();
33-
34-
}).catch(() => {
35-
// always finish and resolve
36-
logger.finish();
37-
});
28+
return lintApp(context, configFile);
29+
}).then(() => {
30+
// always finish and resolve
31+
logger.finish();
32+
}).catch(() => {
33+
// always finish and resolve
34+
logger.finish();
3835
});
3936
}
4037

@@ -55,15 +52,11 @@ export function lintUpdate(event: string, filePath: string, context: BuildContex
5552

5653
export function lintUpdateWorker(context: BuildContext, workerConfig: LintWorkerConfig) {
5754
return getLintConfig(context, workerConfig.configFile).then(configFile => {
58-
// there's a valid tslint config, let's continue (but be quiet about it!)
59-
const program = createProgram(configFile, context.srcDir);
60-
return lintFile(context, program, workerConfig.filePath);
61-
62-
}, () => {
63-
// rejected, but let's ignore
64-
}).catch(() => {
65-
// error, but whateves
66-
});
55+
// there's a valid tslint config, let's continue (but be quiet about it!)
56+
const program = createProgram(configFile, context.srcDir);
57+
return lintFile(context, program, workerConfig.filePath);
58+
}).catch(() => {
59+
});
6760
}
6861

6962

src/sass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export function sassWorker(context: BuildContext, configFile: string) {
8989
reject(reason);
9090
})
9191
.catch(err => {
92-
throw new BuildError(err);
92+
reject(new BuildError(err));
9393
});
9494
});
9595
}

src/worker-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function runWorker(taskModule: string, taskWorker: string, context: Build
2929

3030
worker.on('message', (msg: WorkerMessage) => {
3131
if (msg.error) {
32-
throw new BuildError(msg.error);
32+
reject(new BuildError(msg.error));
3333
} else if (msg.reject) {
3434
reject(new BuildError(msg.reject));
3535
} else {

0 commit comments

Comments
 (0)