Skip to content

Commit 7c07bff

Browse files
mheveryvicb
authored andcommitted
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;
1 parent 86ba072 commit 7c07bff

File tree

142 files changed

+553
-762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+553
-762
lines changed

modules/@angular/common/src/directives/ng_for.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BaseException, ChangeDetectorRef, CollectionChangeRecord, DefaultIterableDiffer, Directive, DoCheck, EmbeddedViewRef, Input, IterableDiffer, IterableDiffers, OnChanges, SimpleChanges, TemplateRef, TrackByFn, ViewContainerRef} from '@angular/core';
9+
import {ChangeDetectorRef, CollectionChangeRecord, DefaultIterableDiffer, Directive, DoCheck, EmbeddedViewRef, Input, IterableDiffer, IterableDiffers, OnChanges, SimpleChanges, TemplateRef, TrackByFn, ViewContainerRef} from '@angular/core';
1010

1111
import {getTypeNameForDebugging, isBlank, isPresent} from '../facade/lang';
1212

@@ -112,7 +112,7 @@ export class NgFor implements DoCheck, OnChanges {
112112
try {
113113
this._differ = this._iterableDiffers.find(value).create(this._cdr, this.ngForTrackBy);
114114
} catch (e) {
115-
throw new BaseException(
115+
throw new Error(
116116
`Cannot find a differ supporting object '${value}' of type '${getTypeNameForDebugging(value)}'. NgFor only supports binding to Iterables such as Arrays.`);
117117
}
118118
}

modules/@angular/common/src/location/path_location_strategy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BaseException, Inject, Injectable, Optional} from '@angular/core';
9+
import {Inject, Injectable, Optional} from '@angular/core';
1010

1111
import {isBlank} from '../facade/lang';
1212

@@ -53,7 +53,7 @@ export class PathLocationStrategy extends LocationStrategy {
5353
}
5454

5555
if (isBlank(href)) {
56-
throw new BaseException(
56+
throw new Error(
5757
`No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.`);
5858
}
5959

modules/@angular/common/src/pipes/async_pipe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {ChangeDetectorRef, OnDestroy, Pipe, WrappedValue} from '@angular/core';
1010
import {EventEmitter, Observable} from '../facade/async';
1111
import {isBlank, isPresent, isPromise} from '../facade/lang';
12-
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
12+
import {InvalidPipeArgumentError} from './invalid_pipe_argument_error';
1313

1414
interface SubscriptionStrategy {
1515
createSubscription(async: any, updateLatestValue: any): any;
@@ -128,7 +128,7 @@ export class AsyncPipe implements OnDestroy {
128128
} else if ((<any>obj).subscribe) {
129129
return _observableStrategy;
130130
} else {
131-
throw new InvalidPipeArgumentException(AsyncPipe, obj);
131+
throw new InvalidPipeArgumentError(AsyncPipe, obj);
132132
}
133133
}
134134

modules/@angular/common/src/pipes/date_pipe.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import {Inject, LOCALE_ID, Pipe, PipeTransform} from '@angular/core';
1111
import {StringMapWrapper} from '../facade/collection';
1212
import {DateFormatter} from '../facade/intl';
1313
import {DateWrapper, NumberWrapper, isBlank, isDate, isString} from '../facade/lang';
14-
15-
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
14+
import {InvalidPipeArgumentError} from './invalid_pipe_argument_error';
1615

1716

1817
/**
@@ -102,7 +101,7 @@ export class DatePipe implements PipeTransform {
102101
if (isBlank(value)) return null;
103102

104103
if (!this.supports(value)) {
105-
throw new InvalidPipeArgumentException(DatePipe, value);
104+
throw new InvalidPipeArgumentError(DatePipe, value);
106105
}
107106

108107
if (NumberWrapper.isNumeric(value)) {

modules/@angular/common/src/pipes/i18n_plural_pipe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {Pipe, PipeTransform} from '@angular/core';
1010
import {StringWrapper, isBlank, isStringMap} from '../facade/lang';
1111
import {NgLocalization, getPluralCategory} from '../localization';
12-
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
12+
import {InvalidPipeArgumentError} from './invalid_pipe_argument_error';
1313

1414
const _INTERPOLATION_REGEXP: RegExp = /#/g;
1515

@@ -58,7 +58,7 @@ export class I18nPluralPipe implements PipeTransform {
5858
if (isBlank(value)) return '';
5959

6060
if (!isStringMap(pluralMap)) {
61-
throw new InvalidPipeArgumentException(I18nPluralPipe, pluralMap);
61+
throw new InvalidPipeArgumentError(I18nPluralPipe, pluralMap);
6262
}
6363

6464
const key = getPluralCategory(value, Object.keys(pluralMap), this._localization);

modules/@angular/common/src/pipes/i18n_select_pipe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {Pipe, PipeTransform} from '@angular/core';
1010
import {isBlank, isStringMap} from '../facade/lang';
11-
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
11+
import {InvalidPipeArgumentError} from './invalid_pipe_argument_error';
1212

1313
/**
1414
*
@@ -47,7 +47,7 @@ export class I18nSelectPipe implements PipeTransform {
4747
if (isBlank(value)) return '';
4848

4949
if (!isStringMap(mapping)) {
50-
throw new InvalidPipeArgumentException(I18nSelectPipe, mapping);
50+
throw new InvalidPipeArgumentError(I18nSelectPipe, mapping);
5151
}
5252

5353
return mapping.hasOwnProperty(value) ? mapping[value] : '';

modules/@angular/common/src/pipes/invalid_pipe_argument_error.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BaseException, Type} from '@angular/core';
9+
import {Type} from '@angular/core';
10+
11+
import {BaseError} from '../facade/errors';
1012
import {stringify} from '../facade/lang';
1113

12-
export class InvalidPipeArgumentException extends BaseException {
14+
export class InvalidPipeArgumentError extends BaseError {
1315
constructor(type: Type<any>, value: Object) {
1416
super(`Invalid argument '${value}' for pipe '${stringify(type)}'`);
1517
}

modules/@angular/common/src/pipes/lowercase_pipe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {Pipe, PipeTransform} from '@angular/core';
1010
import {isBlank, isString} from '../facade/lang';
11-
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
11+
import {InvalidPipeArgumentError} from './invalid_pipe_argument_error';
1212

1313

1414
/**
@@ -25,7 +25,7 @@ export class LowerCasePipe implements PipeTransform {
2525
transform(value: string): string {
2626
if (isBlank(value)) return value;
2727
if (!isString(value)) {
28-
throw new InvalidPipeArgumentException(LowerCasePipe, value);
28+
throw new InvalidPipeArgumentError(LowerCasePipe, value);
2929
}
3030
return value.toLowerCase();
3131
}

modules/@angular/common/src/pipes/number_pipe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {Inject, LOCALE_ID, Pipe, PipeTransform, Type} from '@angular/core';
1111
import {NumberFormatStyle, NumberFormatter} from '../facade/intl';
1212
import {NumberWrapper, isBlank, isNumber, isPresent, isString} from '../facade/lang';
1313

14-
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
14+
import {InvalidPipeArgumentError} from './invalid_pipe_argument_error';
1515

1616
const _NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(\-(\d+))?)?$/;
1717

@@ -22,7 +22,7 @@ function formatNumber(
2222
// Convert strings to numbers
2323
value = isString(value) && NumberWrapper.isNumeric(value) ? +value : value;
2424
if (!isNumber(value)) {
25-
throw new InvalidPipeArgumentException(pipe, value);
25+
throw new InvalidPipeArgumentError(pipe, value);
2626
}
2727
let minInt: number;
2828
let minFraction: number;

modules/@angular/common/src/pipes/slice_pipe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {Pipe, PipeTransform} from '@angular/core';
1010
import {ListWrapper} from '../facade/collection';
1111
import {StringWrapper, isArray, isBlank, isString} from '../facade/lang';
12-
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
12+
import {InvalidPipeArgumentError} from './invalid_pipe_argument_error';
1313

1414
/**
1515
* Creates a new List or String containing only a subset (slice) of the
@@ -72,7 +72,7 @@ export class SlicePipe implements PipeTransform {
7272
transform(value: any, start: number, end: number = null): any {
7373
if (isBlank(value)) return value;
7474
if (!this.supports(value)) {
75-
throw new InvalidPipeArgumentException(SlicePipe, value);
75+
throw new InvalidPipeArgumentError(SlicePipe, value);
7676
}
7777
if (isString(value)) {
7878
return StringWrapper.slice(value, start, end);

0 commit comments

Comments
 (0)