Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request improves error handling and reporting when creating a Managed Spark Session. Key changes include changing ManagedSparkConnectException to inherit from RuntimeError, adding detailed error extraction and formatting logic for API errors (such as invalid project IDs, invalid regions, and malformed session templates), and introducing a helper function to clean up failed session creations. Additionally, comprehensive integration and unit tests have been added to verify these error handling paths. There are no review comments to address, and I have no further feedback to provide.
…ion template When create_session fails due to a typo in the project ID, region, or session template, explain the underlying failure instead of raising an opaque HTTP 404 or swallowing structured error details: - Catch MethodNotImplemented alongside InvalidArgument and PermissionDenied, and translate HTTP 404 responses from the regional endpoint (<region> /usr/local/google/home/dborowitz/.gemini/config/-dataproc.googleapis.com) into an actionable message telling the user to verify that the location is a valid Managed Spark region. - Surface structured DebugInfo details, ErrorInfo reasons (CONSUMER_INVALID, RESOURCE_PROJECT_INVALID, LOCATION_POLICY_VIOLATED), and BadRequest field violations when formatting session creation errors, plus a format hint when a malformed session_template reference fails with a generic InvalidArgument. - Chain the original exception with 'from e' and make ManagedSparkConnectException inherit from RuntimeError so callers catching either exception type continue to work and full tracebacks preserve the underlying gRPC error. - Add unit and integration tests covering invalid project IDs, invalid regions, and nonexistent or malformed session templates.
dborowitz
force-pushed
the
dborowitz-create-session-errors
branch
from
November 3, 2026 02:43
1b2d66b to
4492068
Compare
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.
When
create_sessionfails due to a typo in the project ID, region, or session template, surface the underlying error details instead of raising an opaque HTTP 404 or dropping structured gRPC metadata:MethodNotImplementedalongsideInvalidArgumentandPermissionDenied, and translate HTTP 404 responses from the regional endpoint (<region> /usr/local/google/home/dborowitz/.gemini/config/-dataproc.googleapis.com) into an actionable message prompting the user to check that the location is a valid Managed Spark region.DebugInfodetails,ErrorInforeasons (CONSUMER_INVALID,RESOURCE_PROJECT_INVALID,LOCATION_POLICY_VIOLATED), andBadRequestfield violations when formatting session creation errors, plus a format hint when a malformedsession_templatereference fails with a genericInvalidArgument.from eand makeManagedSparkConnectExceptioninherit fromRuntimeErrorso callers catching either exception type continue to work and full tracebacks preserve the underlying gRPC error.