Skip to content

Commit

Permalink
Merge pull request #9506 from ntibi/enhance_circular_dep_error_msg_co…
Browse files Browse the repository at this point in the history
…ntext

feat(core): enhance circular dependency error message
  • Loading branch information
kamilmysliwiec committed May 13, 2022
2 parents c453522 + 9a8adbe commit 002c11a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/injector/container.ts
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 002c11a

Please sign in to comment.