Skip to content

Commit

Permalink
feat(core): enhance circular dependency error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ntibi committed Apr 29, 2022
1 parent 1f6fca5 commit 9a8adbe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/injector/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ export class NestContainer {
provider: Provider,
token: string,
): string | symbol | Function {
const moduleRef = this.modules.get(token);
if (!provider) {
throw new CircularDependencyException();
throw new CircularDependencyException(moduleRef?.metatype.name);
}
if (!this.modules.has(token)) {
if (!moduleRef) {
throw new UnknownModuleException();
}
const moduleRef = this.modules.get(token);
return moduleRef.addProvider(provider);
}

Expand Down

0 comments on commit 9a8adbe

Please sign in to comment.