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;
|
return ngModules;
|
||||||
}, <StaticSymbol[]>[]);
|
}, <StaticSymbol[]>[]);
|
||||||
const analyzedNgModules = this.compiler.analyzeModules(ngModules);
|
const analyzedNgModules = this.compiler.analyzeModules(ngModules);
|
||||||
return Promise
|
return Promise.all(fileMetas.map(
|
||||||
.all(fileMetas.map(
|
(fileMeta) =>
|
||||||
(fileMeta) => this.compiler
|
this.compiler
|
||||||
.compile(
|
.compile(
|
||||||
fileMeta.fileUrl, analyzedNgModules, fileMeta.components,
|
fileMeta.fileUrl, analyzedNgModules, fileMeta.components, fileMeta.ngModules)
|
||||||
fileMeta.ngModules)
|
.then((generatedModules) => {
|
||||||
.then((generatedModules) => {
|
generatedModules.forEach((generatedModule) => {
|
||||||
generatedModules.forEach((generatedModule) => {
|
const sourceFile = this.program.getSourceFile(fileMeta.fileUrl);
|
||||||
const sourceFile = this.program.getSourceFile(fileMeta.fileUrl);
|
const emitPath = this.calculateEmitPath(generatedModule.moduleUrl);
|
||||||
const emitPath =
|
this.host.writeFile(
|
||||||
this.calculateEmitPath(generatedModule.moduleUrl);
|
emitPath, PREAMBLE + generatedModule.source, false, () => {}, [sourceFile]);
|
||||||
this.host.writeFile(
|
});
|
||||||
emitPath, PREAMBLE + generatedModule.source, false, () => {},
|
})));
|
||||||
[sourceFile]);
|
|
||||||
});
|
|
||||||
})))
|
|
||||||
.catch((e) => { console.error(e.stack); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static create(
|
static create(
|
||||||
|
|
|
@ -133,8 +133,7 @@ export class Extractor {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}))
|
}))
|
||||||
.then(_ => this.messageBundle)
|
.then(_ => this.messageBundle);
|
||||||
.catch((e) => { console.error(e.stack); });
|
|
||||||
|
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
throw new Error(errors.map(e => e.toString()).join('\n'));
|
throw new Error(errors.map(e => e.toString()).join('\n'));
|
||||||
|
|
Loading…
Reference in New Issue