fix(Compiler): Catch exceptions in the logging of binding update

fixes #9994
This commit is contained in:
Victor Berchet
2016-07-12 10:26:54 -07:00
parent b4ea0b1601
commit 27436270fd
5 changed files with 48 additions and 28 deletions

View File

@ -1846,6 +1846,21 @@ function declareTests({useJit}: {useJit: boolean}) {
async.done();
});
}));
it('should indicate when toString() throws',
inject(
[TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var tpl = '<div my-dir [elprop]="toStringThrow"></div>';
tcb.overrideView(MyComp, new ViewMetadata({template: tpl, directives: [MyDir]}))
.createAsync(MyComp)
.then((fixture) => {
fixture.detectChanges();
expect(getDOM().getInnerHTML(fixture.debugElement.nativeElement))
.toContain('[ERROR]');
async.done();
});
}));
});
describe('property decorators', () => {
@ -2227,6 +2242,8 @@ class MyComp {
ctxProp: string;
ctxNumProp: number;
ctxBoolProp: boolean;
toStringThrow = {toString: function() { throw 'boom'; }};
constructor() {
this.ctxProp = 'initial value';
this.ctxNumProp = 0;