fix(change_detection): _throwError should not mask the original exception
This commit is contained in:
@ -287,11 +287,19 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
||||
}
|
||||
|
||||
private _throwError(exception: any, stack: any): void {
|
||||
var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null);
|
||||
var context = isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals,
|
||||
c.injector, this._currentBinding().debug) :
|
||||
null;
|
||||
throw new ChangeDetectionError(this._currentBinding().debug, exception, stack, context);
|
||||
var error;
|
||||
try {
|
||||
var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null);
|
||||
var context = isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals,
|
||||
c.injector, this._currentBinding().debug) :
|
||||
null;
|
||||
error = new ChangeDetectionError(this._currentBinding().debug, exception, stack, context);
|
||||
} catch (e) {
|
||||
// if an error happens during getting the debug context, we throw a ChangeDetectionError
|
||||
// without the extra information.
|
||||
error = new ChangeDetectionError(null, exception, stack, null);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
throwOnChangeError(oldValue: any, newValue: any): void {
|
||||
|
@ -254,7 +254,7 @@ export class AppView implements ChangeDispatcher, RenderEventDispatcher {
|
||||
|
||||
} catch (e) {
|
||||
// TODO: vsavkin log the exception once we have a good way to log errors and warnings
|
||||
// if an error happens during getting the debug context, we return an empty map.
|
||||
// if an error happens during getting the debug context, we return null.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user