Skip to content

Commit

Permalink
fix(ngc): propagate errors to main (#11214)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored and mprobst committed Sep 1, 2016
1 parent 53cf714 commit 5e5ae3c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
30 changes: 13 additions & 17 deletions modules/@angular/compiler-cli/src/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,19 @@ export class CodeGenerator {
return ngModules;
}, <StaticSymbol[]>[]);
const analyzedNgModules = this.compiler.analyzeModules(ngModules);
return Promise
.all(fileMetas.map(
(fileMeta) => this.compiler
.compile(
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);
this.host.writeFile(
emitPath, PREAMBLE + generatedModule.source, false, () => {},
[sourceFile]);
});
})))
.catch((e) => { console.error(e.stack); });
return Promise.all(fileMetas.map(
(fileMeta) =>
this.compiler
.compile(
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);
this.host.writeFile(
emitPath, PREAMBLE + generatedModule.source, false, () => {}, [sourceFile]);
});
})));
}

static create(
Expand Down
3 changes: 1 addition & 2 deletions modules/@angular/compiler-cli/src/extract_i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down

0 comments on commit 5e5ae3c

Please sign in to comment.