ErrorHandler can not throw errors because it will unsubscribe itself from the error stream. Zones captures errors and feed it into NgZone, which than has a Rx Observable to feed it into ErrorHandler. If the ErroHandler throws, then Rx will teardown the observable which in essence causes the ErrorHandler to be removed from the error handling. This implies that the ErrorHandler can never throw errors. Closes #14949 Closes #15182 Closes #14316
This commit is contained in:

committed by
Chuck Jazdzewski

parent
492153a986
commit
77fd91d615
@ -42,12 +42,12 @@ export class ErrorHandler {
|
||||
*/
|
||||
_console: Console = console;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
rethrowError: boolean;
|
||||
|
||||
constructor(rethrowError: boolean = true) { this.rethrowError = rethrowError; }
|
||||
constructor(
|
||||
/**
|
||||
* @deprecated since v4.0 parameter no longer has an effect, as ErrorHandler will never
|
||||
* rethrow.
|
||||
*/
|
||||
deprecatedParameter?: boolean) {}
|
||||
|
||||
handleError(error: any): void {
|
||||
const originalError = this._findOriginalError(error);
|
||||
@ -63,10 +63,6 @@ export class ErrorHandler {
|
||||
if (context) {
|
||||
errorLogger(this._console, 'ERROR CONTEXT', context);
|
||||
}
|
||||
|
||||
// We rethrow exceptions, so operations like 'bootstrap' will result in an error
|
||||
// when an error happens. If we do not rethrow, bootstrap will always succeed.
|
||||
if (this.rethrowError) throw error;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
Reference in New Issue
Block a user