diff --git a/modules/@angular/core/src/di/reflective_errors.ts b/modules/@angular/core/src/di/reflective_errors.ts index 5659ddf341..12da8a9db8 100644 --- a/modules/@angular/core/src/di/reflective_errors.ts +++ b/modules/@angular/core/src/di/reflective_errors.ts @@ -68,8 +68,6 @@ export class AbstractProviderError extends BaseError { this.keys.push(key); this.message = this.constructResolvingMessage(this.keys); } - - get context() { return this.injectors[this.injectors.length - 1].debugContext(); } } /** @@ -174,8 +172,6 @@ export class InstantiationError extends WrappedError { } get causeKey(): ReflectiveKey { return this.keys[0]; } - - get context() { return this.injectors[this.injectors.length - 1].debugContext(); } } /** diff --git a/modules/@angular/core/src/di/reflective_injector.ts b/modules/@angular/core/src/di/reflective_injector.ts index 21bfc16937..588234a18f 100644 --- a/modules/@angular/core/src/di/reflective_injector.ts +++ b/modules/@angular/core/src/di/reflective_injector.ts @@ -473,12 +473,6 @@ export abstract class ReflectiveInjector implements Injector { */ get parent(): Injector { return unimplemented(); } - - /** - * @internal - */ - debugContext(): any { return null; } - /** * Resolves an array of providers and creates a child injector from those providers. * @@ -603,19 +597,12 @@ export class ReflectiveInjector_ implements ReflectiveInjector { /** * Private */ - constructor( - _proto: any /* ProtoInjector */, _parent: Injector = null, - private _debugContext: Function = null) { + constructor(_proto: any /* ProtoInjector */, _parent: Injector = null) { this._proto = _proto; this._parent = _parent; this._strategy = _proto._strategy.createInjectorStrategy(this); } - /** - * @internal - */ - debugContext(): any { return this._debugContext(); } - get(token: any, notFoundValue: any = THROW_IF_NOT_FOUND): any { return this._getByKey(ReflectiveKey.get(token), null, null, notFoundValue); } diff --git a/modules/@angular/core/test/di/reflective_injector_spec.ts b/modules/@angular/core/test/di/reflective_injector_spec.ts index 15615d15f0..ab89898234 100644 --- a/modules/@angular/core/test/di/reflective_injector_spec.ts +++ b/modules/@angular/core/test/di/reflective_injector_spec.ts @@ -336,25 +336,6 @@ export function main() { } }); - it('should provide context when throwing an exception ', () => { - var engineProvider = - ReflectiveInjector.resolve([{provide: Engine, useClass: BrokenEngine}])[0]; - var protoParent = new ReflectiveProtoInjector([engineProvider]); - - var carProvider = ReflectiveInjector.resolve([Car])[0]; - var protoChild = new ReflectiveProtoInjector([carProvider]); - - var parent = new ReflectiveInjector_(protoParent, null, () => 'parentContext'); - var child = new ReflectiveInjector_(protoChild, parent, () => 'childContext'); - - try { - child.get(Car); - throw 'Must throw'; - } catch (e) { - expect(e.context).toEqual('childContext'); - } - }); - it('should instantiate an object after a failed attempt', () => { var isBroken = true;