Refine structured error handler typing#2827
Open
abdulselamadillmohammed wants to merge 2 commits intosnowflakedb:mainfrom
Open
Refine structured error handler typing#2827abdulselamadillmohammed wants to merge 2 commits intosnowflakedb:mainfrom
abdulselamadillmohammed wants to merge 2 commits intosnowflakedb:mainfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
|
Please add changelog entry in DESCRIPTION.md |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
I’ve added a changelog entry in DESCRIPTION.md. Please let me know if anything else is needed or if you have any feedback. |
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.
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-3246741: Align structured error-handler typing and ready-exception handling #2790
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
This change aligns the connector’s structured error-handling API with the contract already used in
errors.py.It introduces a shared structured payload type for error details and a shared protocol for error handlers, then applies that contract to the sync connection and cursor
errorhandlerattributes. It also narrows the structured error-handler flow to SnowflakeErrorsubclasses only.In addition, it updates
errorhandler_wrapper_from_ready_exception()so generic Python exceptions are re-raised directly instead of being routed into the dict-based structured handler path. This avoids the inconsistent case described in SNOW-3246741: Align structured error-handler typing and ready-exception handling #2790, where non-Snowflake exceptions could enter a handler flow that expects structured error details.The PR also adds unit tests covering:
- default structured error handling
- forwarding structured payloads to custom handlers
- normalization of ready
Errorinstances- direct re-raise behavior for generic exceptions
(Optional) PR for stored-proc connector: