ManderaGeneral / generalimport

Handle all your optional dependencies with a single call!
https://pypi.org/project/generalimport/
Apache License 2.0
15 stars 1 forks source link

Set the dunders redirect to `error_func` dynamically #29

Closed ZanSara closed 1 year ago

ZanSara commented 1 year ago

These are mostly cosmetic changes that in my very personal opinion help a lot with readability and debugging.

Putting the dunders in a list and setting it dynamically also allows us to keep track of which dunder exactly triggered error_func, something the VSCode's debugger really struggles with when the dunders are set directly.

The log message will be improved with the trigger value as soon as https://github.com/ManderaGeneral/generalimport/pull/19 goes through.

I added a unit test. All other tests are passing.

Mandera commented 1 year ago

Thank you for this, really good idea! We now build the message with name, trigger, and caller

Tests passed here: https://github.com/ZanSara/generalimport/actions/runs/4988187638