fix(di): capture original exception in InvalidBindingError

Fixes #1406

Closes #1459
This commit is contained in:
Pawel Kozlowski
2015-04-20 15:35:16 +02:00
parent fe70c2647a
commit e23004df52
2 changed files with 10 additions and 4 deletions

View File

@ -140,13 +140,17 @@ export class CyclicDependencyError extends AbstractBindingError {
* @exportedAs angular2/di_errors
*/
export class InstantiationError extends AbstractBindingError {
cause;
causeKey;
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
constructor(originalException, key) {
constructor(cause, key) {
super(key, function (keys:List) {
var first = stringify(ListWrapper.first(keys).token);
return `Error during instantiation of ${first}!${constructResolvingPath(keys)}.` +
` ORIGINAL ERROR: ${originalException}`;
` ORIGINAL ERROR: ${cause}`;
});
this.cause = cause;
this.causeKey = key;
}
}