Nest: More informative error message when dependencies are improperly setup

Created on 1 Nov 2017  路  9Comments  路  Source: nestjs/nest

Hello,

I'm just starting to work with nest.js framework and I noticed a couple of times, that I get a similar message:

Nest can't resolve dependencies of the SomeService. Please verify whether all of them are available in the current context

Wouldn't it be possible to tell precisely which dependency is not being picked up? Something like:

Nest was unable to resolve someDependency of SomeService in some.service.ts:15:25.

Some more informative error description would really help here

type todo 馃挌

Most helpful comment

Hi @bytasv,
In progress 馃枌

All 9 comments

Hi @bytasv,
In progress 馃枌

While you're at it, maybe PR that feature against Angular! That would be a really good fx to have to help resolve deps.

Hi @bytasv,
It's done. More informative error messages are available with the latest update (4.3.0) 馃檪

[ExceptionHandler] Nest can't resolve dependencies of the UsersService (+, +, ?, +, +, +). Please verify whether [2] argument is available in the current context.

The error message doesn't make much sense. + and ? don't really say much. Is there documentation that can explain?

@JamesCoonce +'s mean the dependency was found, ? means it is missing. it tells you which dependency is missing in the order of injection

Why not use class name instand of +. And keep ? For unknown class.

That makes a lot more sense. + and ? are extremely vague.

Submitted a PR #814 for this @XGHeaven @JamesCoonce.

The new error message looks like this:

New Error Message

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

menme95 picture menme95  路  3Comments

mishelashala picture mishelashala  路  3Comments

JulianBiermann picture JulianBiermann  路  3Comments

janckerchen picture janckerchen  路  3Comments

cdiaz picture cdiaz  路  3Comments