fix(errors): [2/2] Rename Exception to Error; remove from public API
BREAKING CHANGE: Exceptions are no longer part of the public API. We don't expect that anyone should be referring to the Exception types. ExceptionHandler.call(exception: any, stackTrace?: any, reason?: string): void; change to: ErrorHandler.handleError(error: any): void;
This commit is contained in:

committed by
Victor Berchet

parent
86ba072758
commit
7c07bfff97
@ -21,7 +21,7 @@ import {RenderComponentType, RenderDebugInfo, Renderer} from '../render/api';
|
||||
import {DebugContext, StaticNodeDebugInfo} from './debug_context';
|
||||
import {AppElement} from './element';
|
||||
import {ElementInjector} from './element_injector';
|
||||
import {ExpressionChangedAfterItHasBeenCheckedException, ViewDestroyedException, ViewWrappedException} from './exceptions';
|
||||
import {ExpressionChangedAfterItHasBeenCheckedError, ViewDestroyedError, ViewWrappedError} from './errors';
|
||||
import {ViewRef_} from './view_ref';
|
||||
import {ViewType} from './view_type';
|
||||
import {ViewUtils, ensureSlotCount, flattenNestedViewRenderNodes} from './view_utils';
|
||||
@ -357,7 +357,7 @@ export abstract class AppView<T> {
|
||||
|
||||
eventHandler(cb: Function): Function { return cb; }
|
||||
|
||||
throwDestroyedError(details: string): void { throw new ViewDestroyedException(details); }
|
||||
throwDestroyedError(details: string): void { throw new ViewDestroyedError(details); }
|
||||
}
|
||||
|
||||
export class DebugAppView<T> extends AppView<T> {
|
||||
@ -376,7 +376,7 @@ export class DebugAppView<T> extends AppView<T> {
|
||||
try {
|
||||
return super.create(context, givenProjectableNodes, rootSelectorOrNode);
|
||||
} catch (e) {
|
||||
this._rethrowWithContext(e, e.stack);
|
||||
this._rethrowWithContext(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -386,7 +386,7 @@ export class DebugAppView<T> extends AppView<T> {
|
||||
try {
|
||||
return super.injectorGet(token, nodeIndex, notFoundResult);
|
||||
} catch (e) {
|
||||
this._rethrowWithContext(e, e.stack);
|
||||
this._rethrowWithContext(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -396,7 +396,7 @@ export class DebugAppView<T> extends AppView<T> {
|
||||
try {
|
||||
super.detach();
|
||||
} catch (e) {
|
||||
this._rethrowWithContext(e, e.stack);
|
||||
this._rethrowWithContext(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -406,7 +406,7 @@ export class DebugAppView<T> extends AppView<T> {
|
||||
try {
|
||||
super.destroyLocal();
|
||||
} catch (e) {
|
||||
this._rethrowWithContext(e, e.stack);
|
||||
this._rethrowWithContext(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -416,7 +416,7 @@ export class DebugAppView<T> extends AppView<T> {
|
||||
try {
|
||||
super.detectChanges(throwOnChange);
|
||||
} catch (e) {
|
||||
this._rethrowWithContext(e, e.stack);
|
||||
this._rethrowWithContext(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -427,13 +427,13 @@ export class DebugAppView<T> extends AppView<T> {
|
||||
return this._currentDebugContext = new DebugContext(this, nodeIndex, rowNum, colNum);
|
||||
}
|
||||
|
||||
private _rethrowWithContext(e: any, stack: any) {
|
||||
if (!(e instanceof ViewWrappedException)) {
|
||||
if (!(e instanceof ExpressionChangedAfterItHasBeenCheckedException)) {
|
||||
private _rethrowWithContext(e: any) {
|
||||
if (!(e instanceof ViewWrappedError)) {
|
||||
if (!(e instanceof ExpressionChangedAfterItHasBeenCheckedError)) {
|
||||
this.cdMode = ChangeDetectorStatus.Errored;
|
||||
}
|
||||
if (isPresent(this._currentDebugContext)) {
|
||||
throw new ViewWrappedException(e, stack, this._currentDebugContext);
|
||||
throw new ViewWrappedError(e, this._currentDebugContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -445,7 +445,7 @@ export class DebugAppView<T> extends AppView<T> {
|
||||
try {
|
||||
return superHandler(event);
|
||||
} catch (e) {
|
||||
this._rethrowWithContext(e, e.stack);
|
||||
this._rethrowWithContext(e);
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user