feat: Add new Error InitializationError
to reflect errors during initialization of a dependency
This commit is contained in:
@@ -37,7 +37,6 @@ export class DependencyResolutionError extends TSinjexError {
|
||||
export class InjectorError extends TSinjexError {
|
||||
/**
|
||||
* Creates a new instance of {@link InjectorError}
|
||||
* @param message **The error message**
|
||||
* @param identifier **The identifier of the dependency**
|
||||
* @param originalError **The original error that caused the injection error**
|
||||
*/
|
||||
@@ -65,3 +64,21 @@ export class NoInstantiationMethodError extends TSinjexError {
|
||||
this.name = 'TSinjexNoInstantiationMethodError';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error class for errors during the initialization of a dependency in {@link ITSinjex}.
|
||||
* @see {@link ITSinjex.inject}
|
||||
*/
|
||||
export class InitializationError extends TSinjexError {
|
||||
/**
|
||||
* Creates a new instance of {@link InitializationError}
|
||||
* @param identifier **The identifier of the dependency**
|
||||
* @param originalError **The original error that caused the initialization error**
|
||||
*/
|
||||
constructor(identifier: Identifier, originalError?: Error) {
|
||||
super(
|
||||
`Error initializing dependency ${identifier.toString()} with error: "${originalError}"`,
|
||||
);
|
||||
this.name = 'TSinjexInitializationError';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user