Skip to content

SNOW-3246741: Align structured error-handler typing and ready-exception handling #2790

@abdulselamadillmohammed

Description

I believe I've found an inconsistency in the connector’s structured error-handling flow and wanted maintainer feedback before opening a PR.

The connection/cursor errorhandler typing is looser and less explicit than the structured Error-based contract used in errors.py. There is also a mismatch in the ready-exception path: generic Python exceptions can be routed into the structured handler flow even though that flow expects structured error details rather than Exception.args-style payloads.

I prepared a branch with a proposed fix:

  • branch: typing-errorhandler-protocol

The change does the following:

  • introduces a shared structured payload type for error-handler details
  • introduces a shared structured handler protocol
  • aligns connection.py and cursor.py with that structured contract
  • narrows the structured path to Error subclasses
  • updates the ready-exception wrapper so generic exceptions are re-raised instead of being routed into the dict-based structured handler flow
  • adds unit tests for the structured and ready-exception paths

Before opening the PR, I wanted to confirm:

  1. whether maintainers agree this should be treated as an internal bug/consistency fix
  2. whether narrowing the structured path to Error subclasses is the right direction
  3. whether this should go in as one PR or be split into smaller pieces

Metadata

Metadata

Labels

enhancementThe issue is a request for improvement or a new featurestatus-triageIssue is under initial triage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions