Skip to content

Commit

Permalink
fix(core): add detail to dehydrated detector exception
Browse files Browse the repository at this point in the history
 - 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 angular#6939
  • Loading branch information
justindujardin authored and IgorMinar committed Feb 9, 2016
1 parent 74be3d3 commit e7ad03c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class AbstractChangeDetector<T> 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<string, any>();
Expand Down Expand Up @@ -130,7 +130,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
// facilitate error reporting.
detectChangesInRecords(throwOnChange: boolean): void {
if (!this.hydrated()) {
this.throwDehydratedError();
this.throwDehydratedError(this.id);
}
try {
this.detectChangesInRecordsInternal(throwOnChange);
Expand Down Expand Up @@ -362,7 +362,7 @@ export class AbstractChangeDetector<T> 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];
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/change_detection/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`); }
}

/**
Expand Down

0 comments on commit e7ad03c

Please sign in to comment.