X Tutup
Skip to content

Commit e7ad03c

Browse files
justindujardinIgorMinar
authored andcommitted
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
1 parent 74be3d3 commit e7ad03c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/angular2/src/core/change_detection/abstract_change_detector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
7373

7474
handleEvent(eventName: string, elIndex: number, event: any): boolean {
7575
if (!this.hydrated()) {
76-
this.throwDehydratedError();
76+
this.throwDehydratedError(`${this.id} -> ${eventName}`);
7777
}
7878
try {
7979
var locals = new Map<string, any>();
@@ -130,7 +130,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
130130
// facilitate error reporting.
131131
detectChangesInRecords(throwOnChange: boolean): void {
132132
if (!this.hydrated()) {
133-
this.throwDehydratedError();
133+
this.throwDehydratedError(this.id);
134134
}
135135
try {
136136
this.detectChangesInRecordsInternal(throwOnChange);
@@ -362,7 +362,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
362362
oldValue, newValue, null);
363363
}
364364

365-
throwDehydratedError(): void { throw new DehydratedException(); }
365+
throwDehydratedError(detail: string): void { throw new DehydratedException(detail); }
366366

367367
private _currentBinding(): BindingTarget {
368368
return this.bindingTargets[this.propertyBindingIndex];

modules/angular2/src/core/change_detection/exceptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class ChangeDetectionError extends WrappedException {
9191
* This is an internal Angular error.
9292
*/
9393
export class DehydratedException extends BaseException {
94-
constructor() { super('Attempt to use a dehydrated detector.'); }
94+
constructor(details: string) { super(`Attempt to use a dehydrated detector: ${details}`); }
9595
}
9696

9797
/**

0 commit comments

Comments
 (0)
X Tutup