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
+1 -2
View File
@@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {BaseException} from '@angular/core';
import {ListWrapper, Map, MapWrapper, StringMapWrapper, isListLikeIterable, iterateListLike} from '../src/facade/collection';
import {isBlank} from '../src/facade/lang';
@@ -163,7 +162,7 @@ export class Headers {
/**
* This method is not implemented.
*/
entries() { throw new BaseException('"entries" method is not implemented on Headers class'); }
entries() { throw new Error('"entries" method is not implemented on Headers class'); }
}
// "HTTP character sets are identified by case-insensitive tokens"
+3 -4
View File
@@ -9,7 +9,6 @@
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {makeTypeError} from '../src/facade/exceptions';
import {isPresent, isString} from '../src/facade/lang';
import {BaseRequestOptions, RequestOptions} from './base_request_options';
@@ -125,7 +124,7 @@ export class Http {
} else if (url instanceof Request) {
responseObservable = httpRequest(this._backend, url);
} else {
throw makeTypeError('First argument must be a url string or Request instance.');
throw new Error('First argument must be a url string or Request instance.');
}
return responseObservable;
}
@@ -229,11 +228,11 @@ export class Jsonp extends Http {
}
if (url instanceof Request) {
if (url.method !== RequestMethod.Get) {
makeTypeError('JSONP requests must use GET request method.');
throw new Error('JSONP requests must use GET request method.');
}
responseObservable = httpRequest(this._backend, url);
} else {
throw makeTypeError('First argument must be a url string or Request instance.');
throw new Error('First argument must be a url string or Request instance.');
}
return responseObservable;
}
+1 -3
View File
@@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {makeTypeError} from '../src/facade/exceptions';
import {isString} from '../src/facade/lang';
import {RequestMethod} from './enums';
@@ -20,8 +19,7 @@ export function normalizeMethodName(method: string | RequestMethod): RequestMeth
(g0: string, g1: string, g2: string) => g1.toUpperCase() + g2.toLowerCase());
method = <number>(<{[key: string]: any}>RequestMethod)[method];
if (typeof method !== 'number')
throw makeTypeError(
`Invalid request method. The method "${originalMethod}" is not supported.`);
throw new Error(`Invalid request method. The method "${originalMethod}" is not supported.`);
}
return <RequestMethod>method;
}
@@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {BaseException} from '@angular/core';
import {Json, isString} from '../src/facade/lang';
import {ResponseOptions} from './base_response_options';