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

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {BaseException} from '@angular/core';
import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileIdentifierMap, CompileIdentifierMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTokenMetadata} from '../compile_metadata';
import {ListWrapper, StringMapWrapper} from '../facade/collection';

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {BaseException} from '@angular/core';
import {CompilePipeMetadata} from '../compile_metadata';
import {isBlank, isPresent} from '../facade/lang';
@ -86,7 +85,7 @@ function _findPipeMeta(view: CompileView, name: string): CompilePipeMetadata {
}
}
if (isBlank(pipeMeta)) {
throw new BaseException(
throw new Error(
`Illegal state: Could not find pipe ${name} although the parser should have detected this error!`);
}
return pipeMeta;

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {BaseException} from '@angular/core';
import * as cdAst from '../expression_parser/ast';
import {isArray, isBlank, isPresent} from '../facade/lang';
@ -67,13 +66,13 @@ enum _Mode {
function ensureStatementMode(mode: _Mode, ast: cdAst.AST) {
if (mode !== _Mode.Statement) {
throw new BaseException(`Expected a statement, but saw ${ast}`);
throw new Error(`Expected a statement, but saw ${ast}`);
}
}
function ensureExpressionMode(mode: _Mode, ast: cdAst.AST) {
if (mode !== _Mode.Expression) {
throw new BaseException(`Expected an expression, but saw ${ast}`);
throw new Error(`Expected an expression, but saw ${ast}`);
}
}
@ -145,7 +144,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
op = o.BinaryOperator.BiggerEquals;
break;
default:
throw new BaseException(`Unsupported operation ${ast.operation}`);
throw new Error(`Unsupported operation ${ast.operation}`);
}
return convertToStatementIfNeeded(
@ -273,7 +272,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
if (receiver === this._implicitReceiver) {
var varExpr = this._nameResolver.getLocal(ast.name);
if (isPresent(varExpr)) {
throw new BaseException('Cannot assign to a reference or variable!');
throw new Error('Cannot assign to a reference or variable!');
}
}
return convertToStatementIfNeeded(
@ -291,7 +290,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
visitAll(asts: cdAst.AST[], mode: _Mode): any { return asts.map(ast => this.visit(ast, mode)); }
visitQuote(ast: cdAst.Quote, mode: _Mode): any {
throw new BaseException('Quotes are not supported for evaluation!');
throw new Error('Quotes are not supported for evaluation!');
}
private visit(ast: cdAst.AST, mode: _Mode): any {
@ -466,7 +465,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
private releaseTemporary(temporary: o.ReadVarExpr) {
this._currentTemporary--;
if (temporary.name != temporaryName(this.bindingIndex, this._currentTemporary)) {
throw new BaseException(`Temporary ${temporary.name} released out of order`);
throw new Error(`Temporary ${temporary.name} released out of order`);
}
}
}

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {BaseException} from '@angular/core';
import {CompileDirectiveMetadata, CompileTokenMetadata} from '../compile_metadata';
import {isBlank, isPresent} from '../facade/lang';
@ -28,7 +27,7 @@ export function getPropertyInView(
viewProp = viewProp.prop('parent');
}
if (currView !== definedView) {
throw new BaseException(
throw new Error(
`Internal error: Could not calculate a property in a parent view: ${property}`);
}
if (property instanceof o.ReadPropExpr) {
@ -86,7 +85,7 @@ export function createPureProxy(
var pureProxyId =
argCount < Identifiers.pureProxies.length ? Identifiers.pureProxies[argCount] : null;
if (isBlank(pureProxyId)) {
throw new BaseException(`Unsupported number of argument for pure functions: ${argCount}`);
throw new Error(`Unsupported number of argument for pure functions: ${argCount}`);
}
view.createMethod.addStmt(
o.THIS_EXPR.prop(pureProxyProp.name).set(o.importExpr(pureProxyId).callFn([fn])).toStmt());