python-injector / python-injector/injector

[Question] How to provide custom error messages when a type is not available?

Aperta
#167 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. 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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.