Skip to content

feat(sf_core): expose structured error diagnostics - #1341

Open
zeroshade wants to merge 1 commit into
snowflakedb:mainfrom
zeroshade:feat/sf-core-error-diagnostics
Open

feat(sf_core): expose structured error diagnostics#1341
zeroshade wants to merge 1 commit into
snowflakedb:mainfrom
zeroshade:feat/sf-core-error-diagnostics

Conversation

@zeroshade

Copy link
Copy Markdown
Contributor

Summary

  • expose wrapper-neutral structured diagnostics through ApiError::diagnostics()
  • add a public ErrorDiagnostics object containing vendor code, SQLSTATE, query ID, and request ID
  • preserve server-first SQLSTATE behavior plus sf_core's existing vendor-code and login fallbacks
  • replace the protobuf converter's three private extraction helpers with the public API
  • migrate the existing diagnostic tests to exercise the reusable object

This lets in-process wrappers such as the Rust ADBC driver consume the same normalized diagnostics without matching sf_core's internal RestError variants or duplicating vendor-code/SQLSTATE tests.

Testing

  • cargo test -p sf_core --lib — 1698 passed, 1 ignored
  • cargo check -p sf_core --all-targets
  • cargo check -p sf_core --no-default-features
  • cargo clippy -p sf_core --lib — no findings in changed code
  • cargo doc -p sf_core --no-deps
  • cargo fmt --all -- --check
  • git diff --check

Copilot AI lite review requested due to automatic review settings August 12, 2026 16:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a wrapper-neutral structured diagnostics API to sf_core by introducing ApiError::diagnostics() and a public ErrorDiagnostics type, then refactors the protobuf driver converter to consume that shared API so wrapper implementations can read normalized Snowflake diagnostics without matching internal RestError variants.

Changes:

  • Introduces ErrorDiagnostics and ApiError::diagnostics() to surface vendor code, SQLSTATE, query ID, and request ID in a stable, wrapper-friendly shape.
  • Updates the protobuf DriverException conversion path to use ApiError::diagnostics() instead of local private extraction helpers.
  • Migrates existing diagnostics-focused tests to exercise the new reusable diagnostics object.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
sf_core/src/protobuf/apis/database_driver_v1/converter.rs Replaces private vendor/query/request ID extraction helpers with ApiError::diagnostics() and updates tests accordingly.
sf_core/src/apis/database_driver_v1/mod.rs Re-exports ErrorDiagnostics alongside ApiError for wrapper consumption.
sf_core/src/apis/database_driver_v1/error.rs Adds the ErrorDiagnostics public struct and implements ApiError::diagnostics() with the existing SQLSTATE/vendor-code/login fallback behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants