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

Inconsistent error reporting when no constructors are found #1360

Closed
tillig opened this issue Jan 4, 2023 · 0 comments · Fixed by #1362
Closed

Inconsistent error reporting when no constructors are found #1360

tillig opened this issue Jan 4, 2023 · 0 comments · Fixed by #1362

Comments

@tillig
Copy link
Member

tillig commented Jan 4, 2023

Describe the Bug

I was in the process of writing documentation to explain what to do when the set IConstructorFinder is unable to find any constructors on a component type and noticed we have multiple potential reporting mechanisms for the issue:

This is not only inconsistent (the interface IConstructorFinder indicates you can/should return an empty set and let the activator deal with it) but it also makes it hard to document or prescribe troubleshooting for since the message is so different from one report to another.

I propose:

  • Remove the exception throwing from DefaultConstructorFinder. Let the ReflectionActivator handle it.
  • Update the NoConstructorsFoundException to have a constructor that takes two parameters - the type being scanned and the type of the constructor finder - and use the message from the ReflectionActivator as the message for that constructor.

That would make the message (and stack trace) consistent across the default and specified constructor finder and would make documenting the issue easier.

@tillig tillig linked a pull request Jan 4, 2023 that will close this issue
tillig added a commit that referenced this issue Jan 8, 2023
Fix #1360: Unify the "no constructors found" reporting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant