fix(Compiler): Catch exceptions in the logging of binding update
fixes #9994
This commit is contained in:
@ -193,13 +193,13 @@ export enum BuiltinVar {
|
||||
}
|
||||
|
||||
export class ReadVarExpr extends Expression {
|
||||
public name: any /** TODO #9100 */;
|
||||
public name: string;
|
||||
public builtin: BuiltinVar;
|
||||
|
||||
constructor(name: string|BuiltinVar, type: Type = null) {
|
||||
super(type);
|
||||
if (isString(name)) {
|
||||
this.name = <string>name;
|
||||
this.name = name;
|
||||
this.builtin = null;
|
||||
} else {
|
||||
this.name = null;
|
||||
@ -270,7 +270,7 @@ export class InvokeMethodExpr extends Expression {
|
||||
type: Type = null) {
|
||||
super(type);
|
||||
if (isString(method)) {
|
||||
this.name = <string>method;
|
||||
this.name = method;
|
||||
this.builtin = null;
|
||||
} else {
|
||||
this.name = null;
|
||||
|
@ -11,19 +11,13 @@ import * as cdAst from '../expression_parser/ast';
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {Identifiers} from '../identifiers';
|
||||
import * as o from '../output/output_ast';
|
||||
|
||||
import {DetectChangesVars, ViewProperties} from './constants';
|
||||
|
||||
import {BoundTextAst, BoundElementPropertyAst, DirectiveAst, PropertyBindingType,} from '../template_ast';
|
||||
|
||||
import {CompileView} from './compile_view';
|
||||
import {CompileElement, CompileNode} from './compile_element';
|
||||
import {CompileMethod} from './compile_method';
|
||||
|
||||
import {camelCaseToDashCase} from '../util';
|
||||
|
||||
import {convertCdExpressionToIr} from './expression_converter';
|
||||
|
||||
import {CompileBinding} from './compile_binding';
|
||||
import {BaseException, SecurityContext} from '@angular/core';
|
||||
|
||||
@ -287,12 +281,24 @@ export function bindDirectiveInputs(
|
||||
|
||||
function logBindingUpdateStmt(
|
||||
renderNode: o.Expression, propName: string, value: o.Expression): o.Statement {
|
||||
return o.THIS_EXPR.prop('renderer')
|
||||
.callMethod(
|
||||
'setBindingDebugInfo',
|
||||
[
|
||||
renderNode, o.literal(`ng-reflect-${camelCaseToDashCase(propName)}`),
|
||||
value.isBlank().conditional(o.NULL_EXPR, value.callMethod('toString', []))
|
||||
])
|
||||
.toStmt();
|
||||
const tryStmt =
|
||||
o.THIS_EXPR.prop('renderer')
|
||||
.callMethod(
|
||||
'setBindingDebugInfo',
|
||||
[
|
||||
renderNode, o.literal(`ng-reflect-${camelCaseToDashCase(propName)}`),
|
||||
value.isBlank().conditional(o.NULL_EXPR, value.callMethod('toString', []))
|
||||
])
|
||||
.toStmt();
|
||||
|
||||
const catchStmt = o.THIS_EXPR.prop('renderer')
|
||||
.callMethod(
|
||||
'setBindingDebugInfo',
|
||||
[
|
||||
renderNode, o.literal(`ng-reflect-${camelCaseToDashCase(propName)}`),
|
||||
o.literal('[ERROR] Exception while trying to serialize the value')
|
||||
])
|
||||
.toStmt();
|
||||
|
||||
return new o.TryCatchStmt([tryStmt], [catchStmt]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user