Refactor Error Handling: Introducing Structured, Typed Exceptions for Clearer Server & Validation Errors
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
Línea de trabajo
Start by reviewing the completed exception work in exceptions.py and the HTTP/XML mapping in _api_calls.py. Run the existing test suite, then update tests including test_too_long_uri to cover typed exceptions and backward compatibility. Done means the tests pass and the error-handling documentation includes retry, missing-resource, and permission examples.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem Summary
OpenML-Python currently funnels diverse server and client-side errors into the broad exceptions OpenMLServerError and OpenMLServerException. This limits users and downstream systems from:
- Distinguishing retryable vs non-retryable failures
- Providing meaningful user-facing error messages
- Programmatically responding to rate limits, missing resources, or validation failures
- Debugging large-scale uploads where different failure modes look identical
Current Situation
All these different scenarios raise the same generic exception:
try:
openml.datasets.get_dataset(999999)
except OpenMLServerError:
# Could be dataset missing, rate limit, timeout, validation issue, DB issue, etc.
pass
Proposed Solution
Introducing a hierarchical exception system with specific, typed error classes:
OpenMLServerError (existing)
├── OpenMLURITooLongError (HTTP 414)
├── OpenMLRateLimitError (HTTP 429)
├── OpenMLNotFoundError (HTTP 404)
├── OpenMLTimeoutError (HTTP 408, 504)
├── OpenMLServiceUnavailableError (HTTP 503)
├── OpenMLAuthenticationError (missing/invalid API key)
├── OpenMLNotAuthorizedError (insufficient permissions)
│
└── OpenMLServerException (existing)
├── OpenMLServerNoResult (existing - empty results)
├── OpenMLValidationError (code 163, validation failures)
└── OpenMLDatabaseConnectionError (code 107, temporary DB issues)
Key Benefits
- Typed Exceptions → programmatic handling (except OpenMLRateLimitError: retry).
- HTTP & OpenML Code Mapping → consistent error interpretation.
- Rich Metadata → e.g., retry_after, resource_type, timeout_seconds.
- Backward Compatible → all classes still inherit existing base exceptions.
I will systematically link the changes to this thread. Hope this helps users and contributors alike.
Implementation Checklist
PR1 — Typed Exceptions (exceptions.py only)
- Add new typed exception classes
- Organize categories (HTTP, validation, auth, timeout, DB, etc.)
- Keep backward compatibility
PR2 — Server Error Mapping (_api_calls.py)
- Map HTTP status codes → typed exceptions
- Map OpenML XML error codes → typed exceptions
- Add message-based fallbacks
- Add pre-check for overly long URLs
PR3 — Test Suite Updates
- Update tests to expect typed exceptions
- Fix test_too_long_uri with pre-request check
- Ensure full backward compatibility
PR4 — Documentation
- Update error-handling documentation
- Add examples for retry, missing resources, permissions
- Submit PR4
- Lenguaje dominante
- Python
- Estrellas
- 361
- Forks
- 296
- Merge medio
- 2 d 20 h
- PR fusionados (30 d)
- 2
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 openml/openml-python
-
[ENH] list_estimation_procedures() should include the procedure IDsPosiblemente ocupada @Jayant-kernel la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
openml/openml-python#1750 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
openml/openml-python#1749 ·
Los mantenedores suelen responder en 2 días
-
Documentation Good First Issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
openml/openml-python#1708 · 8 comentarios ·
Los mantenedores suelen responder en 2 días
-
Good First Issue module:Run testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
openml/openml-python#1646 · 8 comentarios · 2 reacciones ·
Los mantenedores suelen responder en 2 días
-
Good First Issue module:Data testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
openml/openml-python#1644 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
Todos los issues de openml/openml-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
PedestrianDynamics/pyFDS-Evac#199 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
521xueweihan/HelloGitHub#3790 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sandialabs/atlas-ui-3#978 ·
Los mantenedores suelen responder en 1 día
-
area: tests perceived difficulty: 2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Nitjsefnie-Harness-Commons/daedalus#1255 ·
Los mantenedores suelen responder en 1 día
-
hf-audiolm-qwen: `generate_until` hardcodes `.to("cuda")` and aborts on non-CUDA acceleratorsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
EleutherAI/lm-evaluation-harness#4256 ·
Los mantenedores suelen responder en 1 día