Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic Error message when exported Component is not listed in Components collection #479

Closed
mcMickJuice opened this issue Mar 6, 2018 · 2 comments

Comments

@mcMickJuice
Copy link

commented Mar 6, 2018

I'm submitting a...


[ ] Regression 
[ ] Bug report
[ / ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

If I omit an exported component from the components collection of a module but include it in the exports collection, I get a cryptic error when importing it into a component into a separate module.

Nest can't resolve dependencies of the OtherController (?). Please verify whether [0] argument
 is available in the current context.

Expected behavior

The error on boot should say something along the lines of "you have included a Component in the 'exports' collection but did not register it in the 'components' collection. This will cause DI to break. Please list all exported components in the 'components' AND 'exports' collection`

Minimal reproduction of the problem with instructions

https://github.com/mcMickJuice/typescript-starter

What is the motivation / use case for changing the behavior?

Better error messaging and less time wasted around incorrect component registration

Environment

    "@nestjs/common": "^4.5.9",
    "@nestjs/core": "^4.5.10",
    "@nestjs/microservices": "^4.5.8",
    "@nestjs/testing": "^4.5.5",
    "@nestjs/websockets": "^4.5.8",
@kamilmysliwiec

This comment has been minimized.

Copy link
Member

commented Mar 6, 2018

Thanks for reporting @mcMickJuice !

@kamilmysliwiec

This comment has been minimized.

Copy link
Member

commented Mar 11, 2018

Added in v4.6.6 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.