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:
Misko Hevery
2016-08-25 00:50:16 -07:00
committed by Victor Berchet
parent 86ba072758
commit 7c07bfff97
142 changed files with 565 additions and 774 deletions
+5 -6
View File
@@ -6,9 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
import {CompilerOptions, ComponentMetadataType, ComponentStillLoadingError, DirectiveMetadataType, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadataType, NgModuleRef, NgZone, OpaqueToken, PipeMetadataType, PlatformRef, Provider, SchemaMetadata} from '../index';
import {CompilerOptions, ComponentMetadataType, DirectiveMetadataType, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadataType, NgModuleRef, NgZone, OpaqueToken, PipeMetadataType, PlatformRef, Provider, SchemaMetadata} from '../index';
import {ListWrapper} from '../src/facade/collection';
import {BaseException} from '../src/facade/exceptions';
import {FunctionWrapper, stringify} from '../src/facade/lang';
import {Type} from '../src/type';
@@ -173,7 +172,7 @@ export class TestBed implements Injector {
*/
initTestEnvironment(ngModule: Type<any>, platform: PlatformRef) {
if (this.platform || this.ngModule) {
throw new BaseException('Cannot set base providers because it has already been called');
throw new Error('Cannot set base providers because it has already been called');
}
this.platform = platform;
this.ngModule = ngModule;
@@ -256,7 +255,7 @@ export class TestBed implements Injector {
this._moduleWithComponentFactories =
this._compiler.compileModuleAndAllComponentsSync(moduleType);
} catch (e) {
if (e instanceof ComponentStillLoadingError) {
if (e.compType) {
throw new Error(
`This test module uses the component ${stringify(e.compType)} which is using a "templateUrl", but they were never compiled. ` +
`Please call "TestBed.compileComponents" before your test.`);
@@ -296,7 +295,7 @@ export class TestBed implements Injector {
private _assertNotInstantiated(methodName: string, methodDescription: string) {
if (this._instantiated) {
throw new BaseException(
throw new Error(
`Cannot ${methodDescription} when the test module has already been instantiated. ` +
`Make sure you are not using \`inject\` before \`${methodName}\`.`);
}
@@ -344,7 +343,7 @@ export class TestBed implements Injector {
const componentFactory = this._moduleWithComponentFactories.componentFactories.find(
(compFactory) => compFactory.componentType === component);
if (!componentFactory) {
throw new BaseException(
throw new Error(
`Cannot create the component ${stringify(component)} as it was not imported into the testing module!`);
}
const noNgZone = this.get(ComponentFixtureNoNgZone, false);