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

Guice extension swallows module loading errors #9

Open
nayeemzen opened this issue May 25, 2022 · 1 comment
Open

Guice extension swallows module loading errors #9

nayeemzen opened this issue May 25, 2022 · 1 comment

Comments

@nayeemzen
Copy link

nayeemzen commented May 25, 2022

The Guice Junit5 extension swallows any module loading errors (e.g errors that could happen during object creation), which leads to a generic error

No ParameterResolver registered for parameter

This makes the actual error cause hard to debug, since we'll have to dig into what's causing the error, most likely with a breakpoint here.

Should it be swallowing ConfigurationException? Might be better to let it fail eagerly since something clearly went wrong trying to load the Guice module, or add some logs so its immediately obvious what the error is.

@JeffFaer
Copy link
Owner

Admittedly, I haven't really been using this project, and I haven't dabbled much with Java modules, so I'm not too familiar with them.

Do module loading errors typically show up as ConfigurationExceptions? I would've thought they'd show up as ExceptionInInitializerErrors (or something similar), which would get wrapped into a ProvisionException.

I think I agree with you that swallowing ConfigurationExceptions seems like a bad idea (ideally, we should just fix the module configuration mistake instead of allowing the test to try and run anyway), and I don't have any notes on what I was thinking back then either :)

If you think this would stop us from swallowing module loading errors, I'd be happy to approve a PR that stops us from swallowing ConfigurationExceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants