refactor(core): move facades out of core

This is part of ongoing work to make core platform-independent.

BREAKING CHANGE

All private exports from 'angular2/src/core/facade/{lang,collection,exception_handler}' should be replaced with 'angular2/src/facade/{lang,collection,exception_handler}'.
This commit is contained in:
vsavkin
2015-11-06 17:34:07 -08:00
committed by Victor Savkin
parent 3593d85807
commit 79472b77ca
451 changed files with 823 additions and 979 deletions
+47
View File
@@ -0,0 +1,47 @@
import {ExceptionHandler} from './exception_handler';
export {ExceptionHandler} from './exception_handler';
export class BaseException extends Error {
public stack: any;
constructor(public message: string = "--") {
super(message);
this.stack = (<any>new Error(message)).stack;
}
toString(): string { return this.message; }
}
export class WrappedException extends Error {
private _wrapperStack: any;
constructor(private _wrapperMessage: string, private _originalException, private _originalStack?,
private _context?) {
super(_wrapperMessage);
this._wrapperStack = (<any>new Error(_wrapperMessage)).stack;
}
get wrapperMessage(): string { return this._wrapperMessage; }
get wrapperStack(): any { return this._wrapperStack; }
get originalException(): any { return this._originalException; }
get originalStack(): any { return this._originalStack; }
get context(): any { return this._context; }
get message(): string { return ExceptionHandler.exceptionToString(this); }
toString(): string { return this.message; }
}
export function makeTypeError(message?: string): Error {
return new TypeError(message);
}
export function unimplemented(): any {
throw new BaseException('unimplemented');
}