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:

committed by
Victor Berchet

parent
86ba072758
commit
7c07bfff97
@ -6,7 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
import {StringWrapper, isBlank, isPresent, isString} from '../facade/lang';
|
||||
|
||||
import * as o from './output_ast';
|
||||
@ -236,7 +235,7 @@ export abstract class AbstractEmitterVisitor implements o.StatementVisitor, o.Ex
|
||||
varName = CATCH_STACK_VAR.name;
|
||||
break;
|
||||
default:
|
||||
throw new BaseException(`Unknown builtin variable ${ast.builtin}`);
|
||||
throw new Error(`Unknown builtin variable ${ast.builtin}`);
|
||||
}
|
||||
}
|
||||
ctx.print(varName);
|
||||
@ -332,7 +331,7 @@ export abstract class AbstractEmitterVisitor implements o.StatementVisitor, o.Ex
|
||||
opStr = '>=';
|
||||
break;
|
||||
default:
|
||||
throw new BaseException(`Unknown operator ${ast.operator}`);
|
||||
throw new Error(`Unknown operator ${ast.operator}`);
|
||||
}
|
||||
ctx.print(`(`);
|
||||
ast.lhs.visitExpression(this, ctx);
|
||||
|
@ -6,7 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
import {isPresent} from '../facade/lang';
|
||||
|
||||
import {AbstractEmitterVisitor, CATCH_ERROR_VAR, CATCH_STACK_VAR, EmitterVisitorContext} from './abstract_emitter';
|
||||
@ -75,7 +74,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
||||
if (ast.builtin === o.BuiltinVar.This) {
|
||||
ctx.print('self');
|
||||
} else if (ast.builtin === o.BuiltinVar.Super) {
|
||||
throw new BaseException(
|
||||
throw new Error(
|
||||
`'super' needs to be handled at a parent ast node, not at the variable level!`);
|
||||
} else {
|
||||
super.visitReadVarExpr(ast, ctx);
|
||||
@ -161,7 +160,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
||||
name = 'bind';
|
||||
break;
|
||||
default:
|
||||
throw new BaseException(`Unknown builtin method: ${method}`);
|
||||
throw new Error(`Unknown builtin method: ${method}`);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
|
||||
import {StringWrapper, evalExpression, isBlank, isPresent, isString} from '../facade/lang';
|
||||
|
||||
@ -40,7 +39,7 @@ class JsEmitterVisitor extends AbstractJsEmitterVisitor {
|
||||
|
||||
visitExternalExpr(ast: o.ExternalExpr, ctx: EmitterVisitorContext): any {
|
||||
if (isBlank(ast.value.name)) {
|
||||
throw new BaseException(`Internal error: unknown identifier ${ast.value}`);
|
||||
throw new Error(`Internal error: unknown identifier ${ast.value}`);
|
||||
}
|
||||
if (isPresent(ast.value.moduleUrl) && ast.value.moduleUrl != this._moduleUrl) {
|
||||
var prefix = this.importsWithPrefixes.get(ast.value.moduleUrl);
|
||||
|
@ -6,7 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
|
||||
import {CompileIdentifierMetadata} from '../compile_metadata';
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
|
@ -6,7 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {isPresent} from '../facade/lang';
|
||||
@ -104,7 +103,7 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
|
||||
}
|
||||
currCtx = currCtx.parent;
|
||||
}
|
||||
throw new BaseException(`Not declared variable ${expr.name}`);
|
||||
throw new Error(`Not declared variable ${expr.name}`);
|
||||
}
|
||||
visitReadVarExpr(ast: o.ReadVarExpr, ctx: _ExecutionContext): any {
|
||||
var varName = ast.name;
|
||||
@ -121,7 +120,7 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
|
||||
varName = CATCH_STACK_VAR;
|
||||
break;
|
||||
default:
|
||||
throw new BaseException(`Unknown builtin variable ${ast.builtin}`);
|
||||
throw new Error(`Unknown builtin variable ${ast.builtin}`);
|
||||
}
|
||||
}
|
||||
var currCtx = ctx;
|
||||
@ -131,7 +130,7 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
|
||||
}
|
||||
currCtx = currCtx.parent;
|
||||
}
|
||||
throw new BaseException(`Not declared variable ${varName}`);
|
||||
throw new Error(`Not declared variable ${varName}`);
|
||||
}
|
||||
visitWriteKeyExpr(expr: o.WriteKeyExpr, ctx: _ExecutionContext): any {
|
||||
var receiver = expr.receiver.visitExpression(this, ctx);
|
||||
@ -163,7 +162,7 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
|
||||
result = receiver.bind(args[0]);
|
||||
break;
|
||||
default:
|
||||
throw new BaseException(`Unknown builtin method ${expr.builtin}`);
|
||||
throw new Error(`Unknown builtin method ${expr.builtin}`);
|
||||
}
|
||||
} else {
|
||||
result = receiver[expr.name].apply(receiver, args);
|
||||
@ -281,7 +280,7 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
|
||||
case o.BinaryOperator.BiggerEquals:
|
||||
return lhs() >= rhs();
|
||||
default:
|
||||
throw new BaseException(`Unknown operator ${ast.operator}`);
|
||||
throw new Error(`Unknown operator ${ast.operator}`);
|
||||
}
|
||||
}
|
||||
visitReadPropExpr(ast: o.ReadPropExpr, ctx: _ExecutionContext): any {
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException, Injectable} from '@angular/core';
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {Math, isBlank, isPresent} from '../facade/lang';
|
||||
|
||||
@ -32,7 +32,7 @@ export class AssetUrl {
|
||||
if (allowNonMatching) {
|
||||
return null;
|
||||
}
|
||||
throw new BaseException(`Url ${url} is not a valid asset: url`);
|
||||
throw new Error(`Url ${url} is not a valid asset: url`);
|
||||
}
|
||||
|
||||
constructor(public packageName: string, public firstLevelDir: string, public modulePath: string) {
|
||||
|
@ -6,7 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
|
||||
import {CompileIdentifierMetadata} from '../compile_metadata';
|
||||
import {isArray, isBlank, isPresent} from '../facade/lang';
|
||||
@ -35,7 +34,7 @@ export function debugOutputAstAsTypeScript(ast: o.Statement | o.Expression | o.T
|
||||
} else if (ast instanceof o.Type) {
|
||||
ast.visitType(converter, ctx);
|
||||
} else {
|
||||
throw new BaseException(`Don't know how to print debug info for ${ast}`);
|
||||
throw new Error(`Don't know how to print debug info for ${ast}`);
|
||||
}
|
||||
});
|
||||
return ctx.toSource();
|
||||
@ -249,7 +248,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
||||
typeStr = 'string';
|
||||
break;
|
||||
default:
|
||||
throw new BaseException(`Unsupported builtin type ${type.name}`);
|
||||
throw new Error(`Unsupported builtin type ${type.name}`);
|
||||
}
|
||||
ctx.print(typeStr);
|
||||
return null;
|
||||
@ -286,7 +285,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
||||
name = 'bind';
|
||||
break;
|
||||
default:
|
||||
throw new BaseException(`Unknown builtin method: ${method}`);
|
||||
throw new Error(`Unknown builtin method: ${method}`);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
@ -302,7 +301,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
||||
private _visitIdentifier(
|
||||
value: CompileIdentifierMetadata, typeParams: o.Type[], ctx: EmitterVisitorContext): void {
|
||||
if (isBlank(value.name)) {
|
||||
throw new BaseException(`Internal error: unknown identifier ${value}`);
|
||||
throw new Error(`Internal error: unknown identifier ${value}`);
|
||||
}
|
||||
if (isPresent(value.moduleUrl) && value.moduleUrl != this._moduleUrl) {
|
||||
var prefix = this.importsWithPrefixes.get(value.moduleUrl);
|
||||
|
@ -6,7 +6,6 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
|
||||
import {CompileIdentifierMetadata} from '../compile_metadata';
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
@ -39,7 +38,7 @@ class _ValueOutputAstTransformer implements ValueTransformer {
|
||||
} else if (value instanceof o.Expression) {
|
||||
return value;
|
||||
} else {
|
||||
throw new BaseException(`Illegal state: Don't now how to compile value ${value}`);
|
||||
throw new Error(`Illegal state: Don't now how to compile value ${value}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user