fix(Compiler): Catch exceptions in the logging of binding update
fixes #9994
This commit is contained in:
@@ -69,16 +69,13 @@ export abstract class Renderer {
|
||||
abstract setBindingDebugInfo(renderElement: any, propertyName: string, propertyValue: string):
|
||||
void;
|
||||
|
||||
abstract setElementClass(renderElement: any, className: string, isAdd: boolean): any
|
||||
/** TODO #9100 */;
|
||||
abstract setElementClass(renderElement: any, className: string, isAdd: boolean): void;
|
||||
|
||||
abstract setElementStyle(renderElement: any, styleName: string, styleValue: string): any
|
||||
/** TODO #9100 */;
|
||||
abstract setElementStyle(renderElement: any, styleName: string, styleValue: string): void;
|
||||
|
||||
abstract invokeElementMethod(renderElement: any, methodName: string, args?: any[]): any
|
||||
/** TODO #9100 */;
|
||||
abstract invokeElementMethod(renderElement: any, methodName: string, args?: any[]): void;
|
||||
|
||||
abstract setText(renderNode: any, text: string): any /** TODO #9100 */;
|
||||
abstract setText(renderNode: any, text: string): void;
|
||||
|
||||
abstract animate(
|
||||
element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[],
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user