Skip to content

Commit c3873be

Browse files
committed
fix(Compiler): asynchronous error reporting
1 parent 2e488f3 commit c3873be

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

modules/angular2/src/core/compiler/compiler.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ export class Compiler {
199199
var protoView = this._compile(ce.componentDirective.type);
200200

201201
if (PromiseWrapper.isPromise(protoView)) {
202-
ListWrapper.push(promises, protoView);
203-
protoView.then(function (protoView) {
204-
ce.inheritedElementBinder.nestedProtoView = protoView;
205-
});
202+
ListWrapper.push(
203+
promises,
204+
protoView.then(function(pv) { ce.inheritedElementBinder.nestedProtoView = pv;})
205+
);
206206
} else {
207207
ce.inheritedElementBinder.nestedProtoView = protoView;
208208
}

modules/angular2/test/core/compiler/compiler_common_tests.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -229,19 +229,17 @@ export function runCompilerCommonTests() {
229229
createNestedComponentSpec('(error -> sync)', templateResolver,
230230
'Failed to load the template for ParentComponent');
231231

232-
// TODO(vicb): Check why errors this fails with Dart
233-
// TODO(vicb): The Promise is rejected with the correct error but an exc is thrown before
234-
//templateResolver = new FakeTemplateResolver();
235-
//templateResolver.setSync(ParentComponent);
236-
//templateResolver.setError(NestedComponent);
237-
//createNestedComponentSpec('(sync -> error)', templateResolver,
238-
// 'Failed to load the template for NestedComponent -> Failed to compile ParentComponent');
239-
//
240-
//templateResolver = new FakeTemplateResolver();
241-
//templateResolver.setAsync(ParentComponent);
242-
//templateResolver.setError(NestedComponent);
243-
//createNestedComponentSpec('(async -> error)', templateResolver,
244-
// 'Failed to load the template for NestedComponent -> Failed to compile ParentComponent');
232+
templateResolver = new FakeTemplateResolver();
233+
templateResolver.setSync(ParentComponent);
234+
templateResolver.setError(NestedComponent);
235+
createNestedComponentSpec('(sync -> error)', templateResolver,
236+
'Failed to load the template for NestedComponent -> Failed to compile ParentComponent');
237+
238+
templateResolver = new FakeTemplateResolver();
239+
templateResolver.setAsync(ParentComponent);
240+
templateResolver.setError(NestedComponent);
241+
createNestedComponentSpec('(async -> error)', templateResolver,
242+
'Failed to load the template for NestedComponent -> Failed to compile ParentComponent');
245243

246244
});
247245

0 commit comments

Comments
 (0)