Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR focuses on improving error handling across the PostgreSQL MCP codebase. Key changes include adding detailed error variants with PgMcpError in src/pg.rs, updating error mappings in src/mcp.rs to use a dedicated helper (map_pg_error), and adding additional test scenarios for error cases in tests/mcp_test.rs.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/mcp_test.rs | Added error scenario tests to verify improved error messaging and SQL validation failures |
| src/pg.rs | Introduced explicit PgMcpError variants and refined SQL validation logic |
| src/mcp.rs | Refactored error mapping to use a dedicated helper function for consistent error conversion |
| src/main.rs | Simplified SSE server startup using serve_with_config |
| Cargo.toml & documentation | Updated dependency versions and adjusted documentation to reflect improved error handling |
Comments suppressed due to low confidence (2)
tests/mcp_test.rs:389
- Using a hard-coded error code substring ('-32603') in your assertions might be brittle if error messages change in the future. Consider checking against structured error variants or error types.
err.to_string().contains("Mcp error: -32603: Connection not found") // Match actual stdio transport error
src/pg.rs:49
- [nitpick] In the conversion from sqlx::Error to PgMcpError, consider capturing more specific context (e.g. the operation context) instead of defaulting to 'unknown'. This can improve debugging clarity when database errors occur.
if let Some(db_err) = e.as_database_error() {
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.
No description provided.