Refactor Error Handling: Introducing Structured, Typed Exceptions for Clearer Server & Validation Errors
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- backend-api-design, documentation, testing-qa
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 361
- Fork
- 296
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openml/openml-python
-
Documentation Good First Issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
openml/openml-python#1708 · 6 bình luận ·
-
Good First Issue module:Run testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
openml/openml-python#1646 · 7 bình luận · 2 reaction ·
-
Good First Issue module:Data testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
openml/openml-python#1644 · 4 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
openml/openml-python#1714 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
openml/openml-python#1711 · 1 bình luận ·
Tất cả issue của openml/openml-python
Issue tương tự
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Đang mởarea: ci bug perceived difficulty: 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ClickHouse/clickhouse-connect#1057 ·