refactor(di): unified di injector and core injector

BREAKING CHANGES:

* InjectAsync and InjectLazy have been removed
* toAsyncFactory has been removed
This commit is contained in:
vsavkin
2015-06-26 15:59:18 -07:00
parent b688dee4c8
commit 22d3943831
49 changed files with 1211 additions and 1669 deletions

View File

@ -140,15 +140,17 @@ export class CyclicDependencyError extends AbstractBindingError {
export class InstantiationError extends AbstractBindingError {
cause;
causeKey;
stack;
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
constructor(cause, key) {
constructor(cause, stack, key) {
super(key, function(keys: List<any>) {
var first = stringify(ListWrapper.first(keys).token);
return `Error during instantiation of ${first}!${constructResolvingPath(keys)}. ORIGINAL ERROR: ${cause}`;
});
this.cause = cause;
this.causeKey = key;
this.stack = stack;
}
}
@ -198,3 +200,18 @@ export class NoAnnotationError extends BaseException {
toString(): string { return this.message; }
}
/**
* Thrown when getting an object by index.
*
* @exportedAs angular2/di_errors
*/
export class OutOfBoundsError extends BaseException {
message: string;
constructor(index) {
super();
this.message = `Index ${index} is out-of-bounds.`;
}
toString(): string { return this.message; }
}