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

[Bug] Dependeny Injection throw exceptions by default if @classmethod constructors don't return value/objects #224

Open
eisenhaus335 opened this issue Aug 12, 2023 · 0 comments

Comments

@eisenhaus335
Copy link

Describe the bug
Dependency Injection do not have exception when constructors don't return object. It be nice if constructors given exception warning when no returned object to warn ahead. But if no-return constructor on dependency injection is expected is also reasonable pattern because we could make if for example if context == null: do something. But i believe first pattern is better for other not stumble around null objects

To Reproduce

@dataclass
class ContextInjection:
    request: Request

    @classmethod
    async def parse_htmx(cls, request: Request):
        # I do something on header here for example
        request.headers["header-X"] = true
        cls(request)

Environment (please complete the following information):

  • OS: Linux Mint
  • Browser Firefox
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

1 participant