feat(core): provide an error context when an exception happens in an error handler

This commit is contained in:
vsavkin
2015-07-27 15:47:42 -07:00
parent 1d4502944c
commit 8543c347a8
13 changed files with 175 additions and 67 deletions

View File

@ -90,8 +90,9 @@ export class AbstractChangeDetector implements ChangeDetector {
throwError(proto: ProtoRecord, exception: any, stack: any): void {
var c = this.dispatcher.getDebugContext(proto.bindingRecord.elementIndex, proto.directiveIndex);
var context = new _Context(c["element"], c["componentElement"], c["directive"], c["context"],
c["locals"], c["injector"], proto.expressionAsString);
var context = isPresent(c) ? new _Context(c.element, c.componentElement, c.directive, c.context,
c.locals, c.injector, proto.expressionAsString) :
null;
throw new ChangeDetectionError(proto, exception, stack, context);
}
}