Improve error context for DI
This commit is contained in:
@@ -41,4 +41,16 @@ export abstract class AbstractFactory<T> {
|
||||
* @return Collection<PropertyDependency>
|
||||
*/
|
||||
abstract getInjectedProperties(): Collection<PropertyDependency>
|
||||
|
||||
/**
|
||||
* Get a human-readable name of the token this factory produces.
|
||||
* This is meant for debugging output only.
|
||||
*/
|
||||
public getTokenName(): string {
|
||||
if ( typeof this.token === 'string' ) {
|
||||
return this.token
|
||||
}
|
||||
|
||||
return this.token.name ?? '(unknown token)'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user