fix(ngc): propagate errors to main (#11214)
This commit is contained in:
parent
53cf71430f
commit
5e5ae3cde6
|
@ -108,23 +108,19 @@ export class CodeGenerator {
|
|||
return ngModules;
|
||||
}, <StaticSymbol[]>[]);
|
||||
const analyzedNgModules = this.compiler.analyzeModules(ngModules);
|
||||
return Promise
|
||||
.all(fileMetas.map(
|
||||
(fileMeta) => this.compiler
|
||||
return Promise.all(fileMetas.map(
|
||||
(fileMeta) =>
|
||||
this.compiler
|
||||
.compile(
|
||||
fileMeta.fileUrl, analyzedNgModules, fileMeta.components,
|
||||
fileMeta.ngModules)
|
||||
fileMeta.fileUrl, analyzedNgModules, fileMeta.components, fileMeta.ngModules)
|
||||
.then((generatedModules) => {
|
||||
generatedModules.forEach((generatedModule) => {
|
||||
const sourceFile = this.program.getSourceFile(fileMeta.fileUrl);
|
||||
const emitPath =
|
||||
this.calculateEmitPath(generatedModule.moduleUrl);
|
||||
const emitPath = this.calculateEmitPath(generatedModule.moduleUrl);
|
||||
this.host.writeFile(
|
||||
emitPath, PREAMBLE + generatedModule.source, false, () => {},
|
||||
[sourceFile]);
|
||||
emitPath, PREAMBLE + generatedModule.source, false, () => {}, [sourceFile]);
|
||||
});
|
||||
})))
|
||||
.catch((e) => { console.error(e.stack); });
|
||||
})));
|
||||
}
|
||||
|
||||
static create(
|
||||
|
|
|
@ -133,8 +133,7 @@ export class Extractor {
|
|||
});
|
||||
}));
|
||||
}))
|
||||
.then(_ => this.messageBundle)
|
||||
.catch((e) => { console.error(e.stack); });
|
||||
.then(_ => this.messageBundle);
|
||||
|
||||
if (errors.length) {
|
||||
throw new Error(errors.map(e => e.toString()).join('\n'));
|
||||
|
|
Loading…
Reference in New Issue