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

Commit 6f7ad27

Browse files
author
Stanislav Panferov
committed
fix(*): fix unrecoverable error during watch
1 parent 2063901 commit 6f7ad27

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/checker.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,15 @@ function processCompile(payload: ICompilePayload) {
9090
if (allDiagnostics.length) {
9191
console.error(colors.yellow('Checker diagnostics:'))
9292
allDiagnostics.forEach(diagnostic => {
93-
var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
9493
var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
95-
console.error(`${colors.cyan(diagnostic.file.fileName)} (${line + 1},${character + 1}):\n ${colors.red(message)}`);
94+
95+
if (diagnostic.file) {
96+
var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
97+
console.error(`${colors.cyan(diagnostic.file.fileName)} (${line + 1},${character + 1}):\n ${colors.red(message)}`);
98+
} else {
99+
console.error(colors.red(message));
100+
}
101+
96102
});
97103
} else {
98104
console.error(colors.green('Your program is fine!'))

src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ function ensureInstance(webpack: WebPack, options: CompilerOptions, instanceName
214214
}
215215
}))
216216
.then(_ => { state.updateProgram(); callback(); })
217-
.catch((err) => callback(err))
217+
.catch(ResolutionError, err => {
218+
console.error(err.message);
219+
callback();
220+
})
221+
.catch((err) => { console.log(err); callback() })
218222
});
219223

220224
if (options.doTypeCheck) {

0 commit comments

Comments
 (0)