From 4e0c368c0390fb7d5d1d010f52be47cac4afd4e1 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Tue, 7 Oct 2014 09:21:00 -0400 Subject: [PATCH] refactor(injector): remove DIError --- modules/di/src/exceptions.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/di/src/exceptions.js b/modules/di/src/exceptions.js index cebf1f1d11..403e716a05 100644 --- a/modules/di/src/exceptions.js +++ b/modules/di/src/exceptions.js @@ -12,13 +12,7 @@ function constructResolvingPath(keys: List) { } } -class DIError extends Error { - toString() { - return this.message; - } -} - -export class ProviderError extends DIError { +export class ProviderError extends Error { constructor(key:Key, constructResolvingMessage:Function){ this.keys = [key]; this.constructResolvingMessage = constructResolvingMessage; @@ -29,6 +23,10 @@ export class ProviderError extends DIError { ListWrapper.push(this.keys, key); this.message = this.constructResolvingMessage(this.keys); } + + toString() { + return this.message; + } } 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){ this.message = `Invalid binding ${binding}`; } + + toString() { + return this.message; + } } -export class NoAnnotationError extends DIError { +export class NoAnnotationError extends Error { constructor(type){ this.message = `Cannot resolve all parameters for ${stringify(type)}`; } + + toString() { + return this.message; + } } \ No newline at end of file