Refactor Error Handling: Introducing Structured, Typed Exceptions for Clearer Server & Validation Errors
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- backend-api-design, documentation, testing-qa
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 361
- Fork
- 296
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
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.
Altre issue di openml/openml-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
openml/openml-python#1750 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
openml/openml-python#1749 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
openml/openml-python#1746 ·
-
Documentation Good First Issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
openml/openml-python#1708 · 7 commenti ·
-
Good First Issue module:Run testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openml/openml-python#1646 · 7 commenti · 2 reazioni ·
Tutte le issue di openml/openml-python
Issue simili
-
bug confirmed issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
open-webui/open-webui#30750 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100