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

kgr::debug::service doesn't detect an error when service doesn't inherit from kgr classes #88

Closed
selat opened this issue Jul 28, 2019 · 2 comments
Milestone

Comments

@selat
Copy link

selat commented Jul 28, 2019

If you pass some random class (not related to dependency injection) to kgr::debug::service it doesn't report an error.

To Reproduce

struct RandomService {};

int main() {
  kgr::container container;
  kgr::debug::service<RandomService>();
  return 0;
}

Expected behavior
Error message with something like "Class doesn't inherit from kgr::service".

Desktop

  • OS: macOS
  • Compiler: clang-1001.0.46.4
@gracicot
Copy link
Owner

gracicot commented Jul 28, 2019

Thanks for reporting. Service errors are really hard to maintain right now as they are not tested continuously. I'll take a look at it soon.

Also services are not forced to inherit from kgr::service. As long as the implementation is done correctly, the container should accept it.

@gracicot gracicot added this to the 4.3 milestone Aug 4, 2019
@gracicot
Copy link
Owner

gracicot commented Jan 8, 2022

It should print the correct error message now, and there are tests to enforce this.

@gracicot gracicot closed this as completed Jan 8, 2022
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