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
@@ -18,7 +18,6 @@ import {DomRootRenderer} from '@angular/platform-browser/src/dom/dom_renderer';
import {EventEmitter} from '../../src/facade/async';
import {StringMapWrapper} from '../../src/facade/collection';
import {BaseException} from '../../src/facade/exceptions';
import {NumberWrapper, isBlank} from '../../src/facade/lang';
export function main() {
@@ -724,7 +723,7 @@ export function main() {
try {
ctx.detectChanges(false);
} catch (e) {
throw new BaseException('Second detectChanges() should not have run detection.');
throw new Error('Second detectChanges() should not have run detection.');
}
expect(directiveLog.filter(['ngOnInit'])).toEqual([]);
}));
@@ -821,7 +820,7 @@ export function main() {
try {
ctx.detectChanges(false);
} catch (e) {
throw new BaseException('Second detectChanges() should not have run detection.');
throw new Error('Second detectChanges() should not have run detection.');
}
expect(directiveLog.filter(['ngAfterContentInit'])).toEqual([]);
}));
@@ -935,7 +934,7 @@ export function main() {
try {
ctx.detectChanges(false);
} catch (e) {
throw new BaseException('Second detectChanges() should not have run detection.');
throw new Error('Second detectChanges() should not have run detection.');
}
expect(directiveLog.filter(['ngAfterViewInit'])).toEqual([]);
}));
@@ -1342,7 +1341,7 @@ class TestDirective implements OnInit, DoCheck, OnChanges, AfterContentInit, Aft
ngOnInit() {
this.log.add(this.name, 'ngOnInit');
if (this.throwOn == 'ngOnInit') {
throw new BaseException('Boom!');
throw new Error('Boom!');
}
}
@@ -1352,42 +1351,42 @@ class TestDirective implements OnInit, DoCheck, OnChanges, AfterContentInit, Aft
StringMapWrapper.forEach(changes, (c: SimpleChange, key: string) => r[key] = c.currentValue);
this.changes = r;
if (this.throwOn == 'ngOnChanges') {
throw new BaseException('Boom!');
throw new Error('Boom!');
}
}
ngAfterContentInit() {
this.log.add(this.name, 'ngAfterContentInit');
if (this.throwOn == 'ngAfterContentInit') {
throw new BaseException('Boom!');
throw new Error('Boom!');
}
}
ngAfterContentChecked() {
this.log.add(this.name, 'ngAfterContentChecked');
if (this.throwOn == 'ngAfterContentChecked') {
throw new BaseException('Boom!');
throw new Error('Boom!');
}
}
ngAfterViewInit() {
this.log.add(this.name, 'ngAfterViewInit');
if (this.throwOn == 'ngAfterViewInit') {
throw new BaseException('Boom!');
throw new Error('Boom!');
}
}
ngAfterViewChecked() {
this.log.add(this.name, 'ngAfterViewChecked');
if (this.throwOn == 'ngAfterViewChecked') {
throw new BaseException('Boom!');
throw new Error('Boom!');
}
}
ngOnDestroy() {
this.log.add(this.name, 'ngOnDestroy');
if (this.throwOn == 'ngOnDestroy') {
throw new BaseException('Boom!');
throw new Error('Boom!');
}
}
}
@@ -6,8 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import {ANALYZE_FOR_ENTRY_COMPONENTS, Component, ComponentFactoryResolver, NoComponentFactoryError, forwardRef} from '@angular/core';
import {ANALYZE_FOR_ENTRY_COMPONENTS, Component, ComponentFactoryResolver, forwardRef} from '@angular/core';
import {NoComponentFactoryError} from '@angular/core/src/linker/component_factory_resolver';
import {TestBed} from '@angular/core/testing';
import {Console} from '../../src/console';
@@ -23,7 +23,6 @@ import {dispatchEvent, el} from '@angular/platform-browser/testing/browser_util'
import {expect} from '@angular/platform-browser/testing/matchers';
import {EventEmitter} from '../../src/facade/async';
import {BaseException} from '../../src/facade/exceptions';
import {isBlank, isPresent, stringify} from '../../src/facade/lang';
const ANCHOR_ELEMENT = new OpaqueToken('AnchorElement');
@@ -2091,7 +2090,7 @@ class OtherDuplicateDir {
@Directive({selector: 'directive-throwing-error'})
class DirectiveThrowingAnError {
constructor() { throw new BaseException('BOOM'); }
constructor() { throw new Error('BOOM'); }
}
@Component({
@@ -11,14 +11,13 @@ import {Console} from '@angular/core/src/console';
import {ComponentFixture, TestBed, inject} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/matchers';
import {BaseException} from '../../src/facade/exceptions';
import {stringify} from '../../src/facade/lang';
import {NgModuleInjector} from '../../src/linker/ng_module_factory';
class Engine {}
class BrokenEngine {
constructor() { throw new BaseException('Broken Engine'); }
constructor() { throw new Error('Broken Engine'); }
}
class DashboardSoftware {}