fix(compiler): Missing metadata files should result in undefined (#9704)
RelectorHost threw an exception when metadata was requested for a .d.ts file that didn't have a .metadata.json file. Changed it to return undefined. Fixes #9678
This commit is contained in:
@ -184,14 +184,13 @@ export class ReflectorHost implements StaticReflectorHost, ImportGenerator {
|
||||
if (this.context.exists(metadataPath)) {
|
||||
return this.readMetadata(metadataPath);
|
||||
}
|
||||
} else {
|
||||
const sf = this.program.getSourceFile(filePath);
|
||||
if (!sf) {
|
||||
throw new Error(`Source file ${filePath} not present in program.`);
|
||||
}
|
||||
return this.metadataCollector.getMetadata(sf);
|
||||
}
|
||||
|
||||
let sf = this.program.getSourceFile(filePath);
|
||||
if (!sf) {
|
||||
throw new Error(`Source file ${filePath} not present in program.`);
|
||||
}
|
||||
const metadata = this.metadataCollector.getMetadata(sf);
|
||||
return metadata;
|
||||
}
|
||||
|
||||
readMetadata(filePath: string) {
|
||||
|
Reference in New Issue
Block a user