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
This commit is contained in:
Justin DuJardin 2016-02-06 15:40:10 -08:00 committed by Igor Minar
parent 74be3d3fde
commit e7ad03cba6
2 changed files with 4 additions and 4 deletions

View File

@ -73,7 +73,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
handleEvent(eventName: string, elIndex: number, event: any): boolean { handleEvent(eventName: string, elIndex: number, event: any): boolean {
if (!this.hydrated()) { if (!this.hydrated()) {
this.throwDehydratedError(); this.throwDehydratedError(`${this.id} -> ${eventName}`);
} }
try { try {
var locals = new Map<string, any>(); var locals = new Map<string, any>();
@ -130,7 +130,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
// facilitate error reporting. // facilitate error reporting.
detectChangesInRecords(throwOnChange: boolean): void { detectChangesInRecords(throwOnChange: boolean): void {
if (!this.hydrated()) { if (!this.hydrated()) {
this.throwDehydratedError(); this.throwDehydratedError(this.id);
} }
try { try {
this.detectChangesInRecordsInternal(throwOnChange); this.detectChangesInRecordsInternal(throwOnChange);
@ -362,7 +362,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
oldValue, newValue, null); oldValue, newValue, null);
} }
throwDehydratedError(): void { throw new DehydratedException(); } throwDehydratedError(detail: string): void { throw new DehydratedException(detail); }
private _currentBinding(): BindingTarget { private _currentBinding(): BindingTarget {
return this.bindingTargets[this.propertyBindingIndex]; return this.bindingTargets[this.propertyBindingIndex];

View File

@ -91,7 +91,7 @@ export class ChangeDetectionError extends WrappedException {
* This is an internal Angular error. * This is an internal Angular error.
*/ */
export class DehydratedException extends BaseException { export class DehydratedException extends BaseException {
constructor() { super('Attempt to use a dehydrated detector.'); } constructor(details: string) { super(`Attempt to use a dehydrated detector: ${details}`); }
} }
/** /**