python-injector / python-injector/injector

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

Abierto
#167 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
1.5k
Forks
94
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
backend
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.