python-injector / python-injector/injector
[Question] How to provide custom error messages when a type is not available?
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 1.5k
- Fork
- 94
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I would like to expose a FooCredentials dataclass to users as part of a library.
Ignoring the fact that this could probably be done nicely by asking them to pass it to me via the Module initializer, how could I check whether a specific binding has been overriden by the user at time of first access (not at time of binding as user code might not have run yet)? The reason behind it is that I would like to show improved error messages when they're "using the library wrong".
I'm assuming some combination of CallableProvider and try/except on some binder or injector method, but I'm not sure which one is the right place.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Start by tracing first-access resolution through the CallableProvider and the binder or injector methods mentioned in the issue. Determine whether a user override can be detected at first access, and document the supported approach for producing a clearer error message.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100