refactor(injector): remove DIError

This commit is contained in:
vsavkin 2014-10-07 09:21:00 -04:00
parent 62004e22e0
commit 4e0c368c03
1 changed files with 15 additions and 9 deletions

View File

@ -12,13 +12,7 @@ function constructResolvingPath(keys: List) {
} }
} }
class DIError extends Error { export class ProviderError extends Error {
toString() {
return this.message;
}
}
export class ProviderError extends DIError {
constructor(key:Key, constructResolvingMessage:Function){ constructor(key:Key, constructResolvingMessage:Function){
this.keys = [key]; this.keys = [key];
this.constructResolvingMessage = constructResolvingMessage; this.constructResolvingMessage = constructResolvingMessage;
@ -29,6 +23,10 @@ export class ProviderError extends DIError {
ListWrapper.push(this.keys, key); ListWrapper.push(this.keys, key);
this.message = this.constructResolvingMessage(this.keys); this.message = this.constructResolvingMessage(this.keys);
} }
toString() {
return this.message;
}
} }
export class NoProviderError extends ProviderError { export class NoProviderError extends ProviderError {
@ -68,14 +66,22 @@ export class InstantiationError extends ProviderError {
} }
} }
export class InvalidBindingError extends DIError { export class InvalidBindingError extends Error {
constructor(binding){ constructor(binding){
this.message = `Invalid binding ${binding}`; this.message = `Invalid binding ${binding}`;
} }
toString() {
return this.message;
}
} }
export class NoAnnotationError extends DIError { export class NoAnnotationError extends Error {
constructor(type){ constructor(type){
this.message = `Cannot resolve all parameters for ${stringify(type)}`; this.message = `Cannot resolve all parameters for ${stringify(type)}`;
} }
toString() {
return this.message;
}
} }