fix(language-service): do not crash when Angular cannot be located (#14123)

Fixes #14122

PR Close #14123
This commit is contained in:
Chuck Jazdzewski
2017-01-26 12:42:48 -08:00
committed by Miško Hevery
parent 5f2b3173d7
commit 49fb8143e8
3 changed files with 44 additions and 1 deletions

View File

@ -321,7 +321,12 @@ export class StaticSymbolResolver {
getSymbolByModule(module: string, symbolName: string, containingFile?: string): StaticSymbol {
const filePath = this.resolveModule(module, containingFile);
if (!filePath) {
throw new Error(`Could not resolve module ${module} relative to ${containingFile}`);
this.reportError(
new Error(`Could not resolve module ${module}${containingFile ? ` relative to $ {
containingFile
} `: ''}`),
null);
return this.getStaticSymbol(`ERROR:${module}`, symbolName);
}
return this.getStaticSymbol(filePath, symbolName);
}