[MCC-1487221] - Error Handling#28
Merged
Merged
Conversation
…ts for later refactoring
There was a problem hiding this comment.
Pull request overview
This PR introduces a new structured error-handling framework spanning the Arrow Flight transport layer, service layer, and public exception types, aiming to normalize server/SDK errors into consistent error_code/message/timestamp/details shapes.
Changes:
- Added Arrow Flight exception parsing/normalization (
parse_dataconnect_error) and updated transport to raise structured transport errors. - Added service-layer error translation (
translate_error) and updatedDefaultDataConnectServiceto use structuredValidationErrorfor input validation. - Converted public exceptions to dataclasses and removed some previously exported exception types; all existing tests were commented out.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_service.py | Entire test module commented out (disables service behavior coverage). |
| tests/test_service_default.py | Entire test module commented out (disables get_studies validation/request-body coverage). |
| tests/test_client.py | Entire test module commented out (disables client delegation/connect/close coverage). |
| dataconnect/transport/errors.py | Reworked transport errors into structured dataclasses with optional details. |
| dataconnect/transport/arrow_flight/transport.py | Uses centralized error parser and raises structured validation errors for unsupported actions. |
| dataconnect/transport/arrow_flight/error_handler.py | New: parses/normalizes Arrow Flight error messages into typed TransportError variants. |
| dataconnect/service/error_handler.py | New: translates transport errors into public DataConnectError variants. |
| dataconnect/service/default.py | Uses translate_error; adds structured input validation but changes/weakens validation in get_studies and inconsistently handles mapping errors. |
| dataconnect/exceptions.py | Reworked public exceptions into structured dataclasses (introduces constructor/signature breaking changes). |
| dataconnect/init.py | Removes ConnectionError/QueryError from public exports. |
Comments suppressed due to low confidence (1)
dataconnect/service/default.py:44
- Input validation for search_study_name is currently commented out. As a result, passing a non-string truthy value (e.g., 123) will raise AttributeError on .strip() before the try/except, leaking a raw exception instead of a ValidationError/DataConnectError. Please reinstate validate_search_study_name (or add an explicit type check) and ensure request-building is covered by error translation.
# validate_search_study_name(search_study_name)
request = ResourceQuery(action=_ACTION_LIST_STUDIES)
if search_study_name and search_study_name.strip() != "":
request = request.append_body({"search_study_name": search_study_name})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
butsyk-mdsol
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[MCC-1487221] - Error Handling
Changes