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

more readable errors #66

Closed
bomzheg opened this issue Feb 21, 2024 · 1 comment · Fixed by #70
Closed

more readable errors #66

bomzheg opened this issue Feb 21, 2024 · 1 comment · Fixed by #70
Labels
enhancement New feature or request

Comments

@bomzheg
Copy link

bomzheg commented Feb 21, 2024

if I've forgot scope i received this error

E               KeyError: None

..\..\AppData\Local\pypoetry\Cache\virtualenvs\shvatka-7O9jFSMq-py3.11\Lib\site-packages\dishka\registry.py:84: KeyError

please add to error provider name (and will be greate if method name or provided type for case with really many @provide functiuons in one provider)

if I created sync container and add async provider i receive next error:

ValueError: Unsupported type FactoryType.ASYNC_GENERATOR

will be greate to add to error why (wrong type of container)

@bomzheg
Copy link
Author

bomzheg commented Feb 22, 2024

i've got next error

  File "C:\Users\ychebyshev\PycharmProjects\Shvatka\shvatka\tgbot\middlewares\init_middleware.py", line 67, in __call__
    data["file_gateway"] = await request_dishka.get(FileGateway)  # type: ignore[type-abstract]
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\ychebyshev\AppData\Local\pypoetry\Cache\virtualenvs\shvatka-7O9jFSMq-py3.11\Lib\site-packages\dishka\async_container.py", line 114, in _get_unlocked
    raise ValueError(f"No provider found for {dependency_type!r}")
ValueError: No provider found for <class 'shvatka.infrastructure.db.dao.holder.HolderDao'>

in line 66 i've just received HolderDao. it was incomprehensible error.
Isolved it, when found that dao is in REQUEST scope and FileGateway is in APP scope (that was my mistake, both should be in REQUEST scope)

please make this error more comprehensible too

@Tishka17 Tishka17 added the enhancement New feature or request label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants