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

Improve descriptor error messages #340

Merged

Conversation

hypergonial
Copy link
Contributor

Summary

This is a small PR aimed at improving the error message emitted when trying to access an attribute of an InjectedDescriptor. This should only happen if the user calls a function without DI that has alluka.inject() defaults set, and then tries accessing attributes of one such parameter.

So instead of an error like this:

AttributeError: 'InjectedDescriptor' object has no attribute 'value'

You get this:

AttributeError: Tried accessing a parameter that was not injected yet. Did you forget to inject dependencies?

Checklist

  • I have run nox and all the pipelines have passed.
  • I have made unittests according to the code I have added/modified/deleted.

@hypergonial
Copy link
Contributor Author

Good bot.

alluka/_types.py Outdated Show resolved Hide resolved
@FasterSpeeding FasterSpeeding merged commit f11e2b5 into FasterSpeeding:master Apr 22, 2024
18 of 19 checks passed
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

Successfully merging this pull request may close these issues.

2 participants