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
@ -9,13 +9,12 @@
|
||||
// ATTENTION: This file will be overwritten with generated code by main()
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter';
|
||||
import {BaseException} from '@angular/core';
|
||||
|
||||
import {print} from '../../src/facade/lang';
|
||||
import {assetUrl} from '../../src/util';
|
||||
|
||||
function unimplemented(): any {
|
||||
throw new BaseException('unimplemented');
|
||||
throw new Error('unimplemented');
|
||||
}
|
||||
|
||||
import {SimpleJsImportGenerator, codegenExportsVars, codegenStmts} from './output_emitter_util';
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
// ATTENTION: This file will be overwritten with generated code by main()
|
||||
import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter';
|
||||
import {BaseException} from '@angular/core';
|
||||
|
||||
import {print} from '../../src/facade/lang';
|
||||
import {assetUrl} from '../../src/util';
|
||||
@ -16,7 +15,7 @@ import {assetUrl} from '../../src/util';
|
||||
import {SimpleJsImportGenerator, codegenExportsVars, codegenStmts} from './output_emitter_util';
|
||||
|
||||
export function getExpressions(): any {
|
||||
throw new BaseException('unimplemented');
|
||||
throw new Error('unimplemented');
|
||||
}
|
||||
|
||||
// Generator
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {interpretStatements} from '@angular/compiler/src/output/output_interpreter';
|
||||
import {jitStatements} from '@angular/compiler/src/output/output_jit';
|
||||
import {BaseException, EventEmitter} from '@angular/core';
|
||||
import {EventEmitter} from '@angular/core';
|
||||
import {ViewType} from '@angular/core/src/linker/view_type';
|
||||
import {beforeEach, ddescribe, describe, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
@ -179,7 +179,7 @@ export function main() {
|
||||
() => { expect(expressions['throwError']).toThrowError('someError'); });
|
||||
|
||||
it('should support catching errors', () => {
|
||||
function someOperation() { throw new BaseException('Boom!'); }
|
||||
function someOperation() { throw new Error('Boom!'); }
|
||||
|
||||
var errorAndStack = expressions['catchError'](someOperation);
|
||||
expect(errorAndStack[0].message).toEqual('Boom!');
|
||||
|
@ -10,7 +10,8 @@ import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata'
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
import {ImportGenerator} from '@angular/compiler/src/output/path_util';
|
||||
import {assetUrl} from '@angular/compiler/src/util';
|
||||
import {BaseException, EventEmitter} from '@angular/core';
|
||||
import {EventEmitter} from '@angular/core';
|
||||
import {BaseError} from '@angular/core/src/facade/errors';
|
||||
import {ViewType} from '@angular/core/src/linker/view_type';
|
||||
|
||||
export class ExternalClass {
|
||||
@ -34,8 +35,8 @@ var enumIdentifier = new CompileIdentifierMetadata({
|
||||
runtime: ViewType.HOST
|
||||
});
|
||||
|
||||
var baseExceptionIdentifier = new CompileIdentifierMetadata(
|
||||
{name: 'BaseException', moduleUrl: assetUrl('core'), runtime: BaseException});
|
||||
var baseErrorIdentifier = new CompileIdentifierMetadata(
|
||||
{name: 'BaseError', moduleUrl: assetUrl('core', 'facade/errors'), runtime: BaseError});
|
||||
|
||||
export var codegenExportsVars = [
|
||||
'getExpressions',
|
||||
@ -68,8 +69,8 @@ var _getExpressionsStmts: o.Statement[] = [
|
||||
.toDeclStmt(),
|
||||
|
||||
o.variable('throwError')
|
||||
.set(o.fn([], [new o.ThrowStmt(o.importExpr(baseExceptionIdentifier).instantiate([o.literal(
|
||||
'someError')]))]))
|
||||
.set(o.fn([], [new o.ThrowStmt(
|
||||
o.importExpr(baseErrorIdentifier).instantiate([o.literal('someError')]))]))
|
||||
.toDeclStmt(),
|
||||
|
||||
o.variable('catchError')
|
||||
|
Reference in New Issue
Block a user