refactor(chore): remove deprecated NgZoneError (#10822)
BREAKING CHANGE: previously deprecated NgZoneError has been removed
This commit is contained in:
parent
48751cceae
commit
3f5331be9d
|
@ -22,7 +22,7 @@ import {NgModuleFactory, NgModuleInjector, NgModuleRef} from './linker/ng_module
|
||||||
import {WtfScopeFn, wtfCreateScope, wtfLeave} from './profile/profile';
|
import {WtfScopeFn, wtfCreateScope, wtfLeave} from './profile/profile';
|
||||||
import {Testability, TestabilityRegistry} from './testability/testability';
|
import {Testability, TestabilityRegistry} from './testability/testability';
|
||||||
import {Type} from './type';
|
import {Type} from './type';
|
||||||
import {NgZone, NgZoneError} from './zone/ng_zone';
|
import {NgZone} from './zone/ng_zone';
|
||||||
|
|
||||||
var _devMode: boolean = true;
|
var _devMode: boolean = true;
|
||||||
var _runModeLocked: boolean = false;
|
var _runModeLocked: boolean = false;
|
||||||
|
@ -300,9 +300,8 @@ export class PlatformRef_ extends PlatformRef {
|
||||||
throw new Error('No ExceptionHandler. Is platform module (BrowserModule) included?');
|
throw new Error('No ExceptionHandler. Is platform module (BrowserModule) included?');
|
||||||
}
|
}
|
||||||
moduleRef.onDestroy(() => ListWrapper.remove(this._modules, moduleRef));
|
moduleRef.onDestroy(() => ListWrapper.remove(this._modules, moduleRef));
|
||||||
ngZone.onError.subscribe({
|
ngZone.onError.subscribe(
|
||||||
next: (error: NgZoneError) => { exceptionHandler.call(error.error, error.stackTrace); }
|
{next: (error: any) => { exceptionHandler.call(error, error ? error.stack : null); }});
|
||||||
});
|
|
||||||
return _callAndReportToExceptionHandler(exceptionHandler, () => {
|
return _callAndReportToExceptionHandler(exceptionHandler, () => {
|
||||||
const initStatus: ApplicationInitStatus = moduleRef.injector.get(ApplicationInitStatus);
|
const initStatus: ApplicationInitStatus = moduleRef.injector.get(ApplicationInitStatus);
|
||||||
return initStatus.donePromise.then(() => {
|
return initStatus.donePromise.then(() => {
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Public API for Zone
|
// Public API for Zone
|
||||||
export {NgZone, NgZoneError} from './zone/ng_zone';
|
export {NgZone} from './zone/ng_zone';
|
||||||
|
|
|
@ -9,10 +9,7 @@
|
||||||
import {EventEmitter} from '../facade/async';
|
import {EventEmitter} from '../facade/async';
|
||||||
import {BaseException} from '../facade/exceptions';
|
import {BaseException} from '../facade/exceptions';
|
||||||
|
|
||||||
import {NgZoneError, NgZoneImpl} from './ng_zone_impl';
|
import {NgZoneImpl} from './ng_zone_impl';
|
||||||
|
|
||||||
export {NgZoneError} from './ng_zone_impl';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +136,7 @@ export class NgZone {
|
||||||
this._checkStable();
|
this._checkStable();
|
||||||
},
|
},
|
||||||
setMacrotask: (hasMacrotasks: boolean) => { this._hasPendingMacrotasks = hasMacrotasks; },
|
setMacrotask: (hasMacrotasks: boolean) => { this._hasPendingMacrotasks = hasMacrotasks; },
|
||||||
onError: (error: NgZoneError) => this._onErrorEvents.emit(error)
|
onError: (error: any) => this._onErrorEvents.emit(error)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,6 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores error information; delivered via [NgZone.onError] stream.
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export class NgZoneError {
|
|
||||||
constructor(public error: any, public stackTrace: any) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export class NgZoneImpl {
|
export class NgZoneImpl {
|
||||||
static isInAngularZone(): boolean { return Zone.current.get('isAngularZone') === true; }
|
static isInAngularZone(): boolean { return Zone.current.get('isAngularZone') === true; }
|
||||||
|
@ -27,7 +19,7 @@ export class NgZoneImpl {
|
||||||
private onLeave: () => void;
|
private onLeave: () => void;
|
||||||
private setMicrotask: (hasMicrotasks: boolean) => void;
|
private setMicrotask: (hasMicrotasks: boolean) => void;
|
||||||
private setMacrotask: (hasMacrotasks: boolean) => void;
|
private setMacrotask: (hasMacrotasks: boolean) => void;
|
||||||
private onError: (error: NgZoneError) => void;
|
private onError: (error: any) => void;
|
||||||
|
|
||||||
constructor({trace, onEnter, onLeave, setMicrotask, setMacrotask, onError}: {
|
constructor({trace, onEnter, onLeave, setMicrotask, setMacrotask, onError}: {
|
||||||
trace: boolean,
|
trace: boolean,
|
||||||
|
@ -35,7 +27,7 @@ export class NgZoneImpl {
|
||||||
onLeave: () => void,
|
onLeave: () => void,
|
||||||
setMicrotask: (hasMicrotasks: boolean) => void,
|
setMicrotask: (hasMicrotasks: boolean) => void,
|
||||||
setMacrotask: (hasMacrotasks: boolean) => void,
|
setMacrotask: (hasMacrotasks: boolean) => void,
|
||||||
onError: (error: NgZoneError) => void
|
onError: (error: any) => void
|
||||||
}) {
|
}) {
|
||||||
this.onEnter = onEnter;
|
this.onEnter = onEnter;
|
||||||
this.onLeave = onLeave;
|
this.onLeave = onLeave;
|
||||||
|
@ -92,7 +84,7 @@ export class NgZoneImpl {
|
||||||
onHandleError: (delegate: ZoneDelegate, current: Zone, target: Zone, error: any):
|
onHandleError: (delegate: ZoneDelegate, current: Zone, target: Zone, error: any):
|
||||||
boolean => {
|
boolean => {
|
||||||
delegate.handleError(target, error);
|
delegate.handleError(target, error);
|
||||||
this.onError(new NgZoneError(error, error.stack));
|
this.onError(error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {NgZone, NgZoneError} from '@angular/core/src/zone/ng_zone';
|
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
||||||
import {AsyncTestCompleter, Log, beforeEach, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
|
import {AsyncTestCompleter, Log, beforeEach, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
|
||||||
import {browserDetection} from '@angular/platform-browser/testing/browser_util';
|
import {browserDetection} from '@angular/platform-browser/testing/browser_util';
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@ const resolvedPromise = Promise.resolve(null);
|
||||||
|
|
||||||
function logOnError() {
|
function logOnError() {
|
||||||
_zone.onError.subscribe({
|
_zone.onError.subscribe({
|
||||||
next: (ngErr: NgZoneError) => {
|
next: (error: any) => {
|
||||||
_errors.push(ngErr.error);
|
_errors.push(error);
|
||||||
_traces.push(ngErr.stackTrace);
|
_traces.push(error.stack);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AnimationEntryMetadata, ChangeDetectorRef, ComponentFactory, ComponentRef, ComponentResolver, DebugElement, ElementRef, Injectable, Injector, NgZone, NgZoneError, OpaqueToken, ViewMetadata, getDebugNode} from '../index';
|
import {ChangeDetectorRef, ComponentRef, DebugElement, ElementRef, NgZone, getDebugNode} from '../index';
|
||||||
import {BaseException} from '../src/facade/exceptions';
|
import {BaseException} from '../src/facade/exceptions';
|
||||||
import {scheduleMicroTask} from '../src/facade/lang';
|
import {scheduleMicroTask} from '../src/facade/lang';
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ export class ComponentFixture<T> {
|
||||||
});
|
});
|
||||||
|
|
||||||
this._onErrorSubscription =
|
this._onErrorSubscription =
|
||||||
ngZone.onError.subscribe({next: (error: NgZoneError) => { throw error.error; }});
|
ngZone.onError.subscribe({next: (error: any) => { throw error; }});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -850,13 +850,6 @@ export declare class NgZone {
|
||||||
static isInAngularZone(): boolean;
|
static isInAngularZone(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare class NgZoneError {
|
|
||||||
error: any;
|
|
||||||
stackTrace: any;
|
|
||||||
constructor(error: any, stackTrace: any);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class NoAnnotationError extends BaseException {
|
export declare class NoAnnotationError extends BaseException {
|
||||||
constructor(typeOrFunc: Type<any> | Function, params: any[][]);
|
constructor(typeOrFunc: Type<any> | Function, params: any[][]);
|
||||||
|
|
Loading…
Reference in New Issue