question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better error handling

See original GitHub issue

Currently if the callable provider fails due to missing arguments or other errors, it may be hard to find out which guy is missing arguments if one provider is being referred many times.

src/dependency_injector/providers.pxd:422: in dependency_injector.providers.__provide_keyword_args
    ???
src/dependency_injector/providers.pxd:345: in dependency_injector.providers.__get_value
    ???
src/dependency_injector/providers.pyx:195: in dependency_injector.providers.Provider.__call__
    ???
src/dependency_injector/providers.pyx:197: in dependency_injector.providers.Provider.__call__
    ???
src/dependency_injector/providers.pyx:2755: in dependency_injector.providers.Singleton._provide
    ???
src/dependency_injector/providers.pxd:620: in dependency_injector.providers.__factory_call
    ???
src/dependency_injector/providers.pxd:606: in dependency_injector.providers.__callable_call
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: __init__() missing 1 required positional argument: 'config'

src/dependency_injector/providers.pxd:579: TypeError

it may be hard to find out which __init__, consider re-raise the exception with the function reference

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
chbndrhnnscommented, Oct 22, 2021

I was troubleshooting a missing argument today in a FastAPI application and I agree that the error handling makes it hard to see where the error occurred. The only hint I get is the token_service.

../../../../Library/Caches/pypoetry/virtualenvs/xxx-auth-v2-7R6iqtGQ-py3.9/lib/python3.9/site-packages/dependency_injector/wiring.py:628: in _patched
    provide = provider()
src/dependency_injector/providers.pyx:207: in dependency_injector.providers.Provider.__call__
    ???
src/dependency_injector/providers.pyx:2385: in dependency_injector.providers.Factory._provide
    ???
src/dependency_injector/providers.pxd:620: in dependency_injector.providers.__factory_call
    ???
src/dependency_injector/providers.pxd:606: in dependency_injector.providers.__callable_call
    ???
src/dependency_injector/providers.pxd:552: in dependency_injector.providers.__call
    ???
src/dependency_injector/providers.pxd:422: in dependency_injector.providers.__provide_keyword_args
    ???
src/dependency_injector/providers.pxd:345: in dependency_injector.providers.__get_value
    ???
src/dependency_injector/providers.pyx:685: in dependency_injector.providers.Dependency.__call__
    ???
src/dependency_injector/providers.pyx:207: in dependency_injector.providers.Provider.__call__
    ???
src/dependency_injector/providers.pyx:2822: in dependency_injector.providers.Singleton._provide
    ???
src/dependency_injector/providers.pxd:620: in dependency_injector.providers.__factory_call
    ???
src/dependency_injector/providers.pxd:606: in dependency_injector.providers.__callable_call
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: __init__() got an unexpected keyword argument 'token_service'

src/dependency_injector/providers.pxd:579: TypeError
0reactions
rmk135commented, Oct 15, 2021

@whysage , no, you can only run it as a C extension

Read more comments on GitHub >

github_iconTop Results From Across the Web

Better error handling in JavaScript | by Iain Collins - Medium
Establishing good error handling conventions in a project can make it easier to improve the user experience of your software, squash mysterious 'unknown...
Read more >
Better error handling in Golang: Theory and practical tips
For more complex error handling, you can define custom error types by implementing the Error() method, which returns the error string.
Read more >
Error Handling Best Practices - Auth0
Error Handling Best Practices · Send error logs to an external service · Use error objects in rules · Use meaningful error code...
Read more >
Clean Code and the Art of Exception Handling - Toptal
Exception Handling: It's a Good Thing · Always create your own ApplicationError hierarchy · Never rescue Exception · Never rescue more exceptions than...
Read more >
SSW.Rules | Rules to Better Error Handling
The best exception handling libraries are: Application Insights (recommended); Seq; RayGun. Your users should never see the “yellow screen of death” in ASP.NET, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found