From e7ad03cba6696fac4eed282ecccd5eb85a36ddb6 Mon Sep 17 00:00:00 2001 From: Justin DuJardin Date: Sat, 6 Feb 2016 15:40:10 -0800 Subject: [PATCH] fix(core): add detail to dehydrated detector exception - at least I know what component is causing the error with this. without it the exception is so generic that it's not useful. Closes #6939 --- .../src/core/change_detection/abstract_change_detector.ts | 6 +++--- modules/angular2/src/core/change_detection/exceptions.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/angular2/src/core/change_detection/abstract_change_detector.ts b/modules/angular2/src/core/change_detection/abstract_change_detector.ts index f3ada379fd..7adaf18a3e 100644 --- a/modules/angular2/src/core/change_detection/abstract_change_detector.ts +++ b/modules/angular2/src/core/change_detection/abstract_change_detector.ts @@ -73,7 +73,7 @@ export class AbstractChangeDetector implements ChangeDetector { handleEvent(eventName: string, elIndex: number, event: any): boolean { if (!this.hydrated()) { - this.throwDehydratedError(); + this.throwDehydratedError(`${this.id} -> ${eventName}`); } try { var locals = new Map(); @@ -130,7 +130,7 @@ export class AbstractChangeDetector implements ChangeDetector { // facilitate error reporting. detectChangesInRecords(throwOnChange: boolean): void { if (!this.hydrated()) { - this.throwDehydratedError(); + this.throwDehydratedError(this.id); } try { this.detectChangesInRecordsInternal(throwOnChange); @@ -362,7 +362,7 @@ export class AbstractChangeDetector implements ChangeDetector { oldValue, newValue, null); } - throwDehydratedError(): void { throw new DehydratedException(); } + throwDehydratedError(detail: string): void { throw new DehydratedException(detail); } private _currentBinding(): BindingTarget { return this.bindingTargets[this.propertyBindingIndex]; diff --git a/modules/angular2/src/core/change_detection/exceptions.ts b/modules/angular2/src/core/change_detection/exceptions.ts index 34e76cd17e..b80ed08b8e 100644 --- a/modules/angular2/src/core/change_detection/exceptions.ts +++ b/modules/angular2/src/core/change_detection/exceptions.ts @@ -91,7 +91,7 @@ export class ChangeDetectionError extends WrappedException { * This is an internal Angular error. */ export class DehydratedException extends BaseException { - constructor() { super('Attempt to use a dehydrated detector.'); } + constructor(details: string) { super(`Attempt to use a dehydrated detector: ${details}`); } } /**