Make socket binding exceptions more debugable
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- networking
Línea de trabajo
Read can/interfaces/socketcan/socketcan.py around lines 589-602, starting with the socket.bind((channel,)) call and its surrounding error handling. Verify that binding failures retain the channel context in the OSError, then inspect nearby areas of the python-can codebase for similarly context-free Python errors and check that the resulting exceptions remain useful to client code.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is your feature request related to a problem? Please describe.
When you hit an OSError, unless you have debug log level tracing enabled your client code may wind up with a bare OSError with little context for what bus was responsible. When more than one bus is involved in your system you're left to disambiguate with some custom code of one's own.
Describe the solution you'd like
I'd like the OSError to have a note added to it with the necessary context to identify what bus channel was involved with the error. A perfect solution would be to augment the logic defined here
https://github.com/hardbyte/python-can/blob/b4f82abede25ff83376be793a2935c41f81c3869/can/interfaces/socketcan/socketcan.py#L589-L602
and replace it with
601c601,607
< sock.bind((channel,))
---
> try:
> sock.bind((channel,))
> except OSError as exc:
> exc_msg = f"Error binding socketcan bus at {channel=}"
> log.exception(exc_msg)
> exc.add_note(exc_msg)
> raise
604d609
<
Describe alternatives you've considered
none
Additional context
Consider any other areas of the python-can codebase that similarly raise naked python errors without context. Those should also benefit by injecting notes with the surrounding context that was being attempted.
- Lenguaje dominante
- Python
- Estrellas
- 1.6k
- Forks
- 697
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de hardbyte/python-can
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
hardbyte/python-can#2103 ·
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
hardbyte/python-can#2077 · 1 comentario · 1 reacción ·
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
hardbyte/python-can#1922 · 1 reacción ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
hardbyte/python-can#2102 ·
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
hardbyte/python-can#2092 ·
Todos los issues de hardbyte/python-can
Issues similares
-
pydanty:is-working
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pydantic/pydantic-ai#8843 ·
Los mantenedores suelen responder en 1 día
-
breaking change enhancement server
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
sktime/sktime#11310 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día