feat(sf_core): expose structured error diagnostics - #1341
Open
zeroshade wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
ErrorDiagnosticsandApiError::diagnostics()to surface vendor code, SQLSTATE, query ID, and request ID in a stable, wrapper-friendly shape. - Updates the protobuf
DriverExceptionconversion path to useApiError::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.
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.
Summary
ApiError::diagnostics()ErrorDiagnosticsobject containing vendor code, SQLSTATE, query ID, and request IDThis lets in-process wrappers such as the Rust ADBC driver consume the same normalized diagnostics without matching sf_core's internal
RestErrorvariants or duplicating vendor-code/SQLSTATE tests.Testing
cargo test -p sf_core --lib— 1698 passed, 1 ignoredcargo check -p sf_core --all-targetscargo check -p sf_core --no-default-featurescargo clippy -p sf_core --lib— no findings in changed codecargo doc -p sf_core --no-depscargo fmt --all -- --checkgit diff --check