chore: Improve error#77
Merged
Merged
Conversation
caa5139 to
adf9eb9
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves error handling in the Fluss Rust client by migrating from thiserror to snafu for error definitions and introducing structured API error responses from the Fluss server. The changes enable more detailed error context and better integration with the server's error reporting protocol.
Key Changes:
- Migrated error definitions from
thiserrortosnafuwith structured error variants containing message and source fields - Implemented Fluss API error protocol by adding
FlussErrorenum,ApiErrorstruct, and error response parsing in RPC headers - Updated all error instantiation sites across the codebase to use the new structured error format
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/fluss/Cargo.toml | Added snafu dependency for structured error handling |
| crates/fluss/src/error.rs | Migrated from thiserror to snafu; restructured error variants with message/source fields; added From trait implementations |
| crates/fluss/src/rpc/fluss_api_error.rs | New file implementing FlussError enum with 57 error codes and ApiError struct for server API errors |
| crates/fluss/src/rpc/mod.rs | Exposed error module and FlussError/ApiError types publicly |
| crates/fluss/src/rpc/error.rs | Added RpcDecodeError variant for protobuf decode errors |
| crates/fluss/src/rpc/frame.rs | Added ProtoErrorResponseDecodeError variant for error response decoding |
| crates/fluss/src/rpc/message/header.rs | Implemented error response parsing in ResponseHeader; added error_response field |
| crates/fluss/src/rpc/server_connection.rs | Updated request method to check for API errors in response headers and convert to FlussAPIError |
| crates/fluss/src/proto/fluss_api.proto | Added ErrorResponse protobuf message definition |
| crates/fluss/src/rpc/message/*.rs | Split ReadError/WriteError imports and added explicit error mapping with map_err |
| crates/fluss/src/metadata/*.rs | Updated error instantiations from tuple variants to struct variants with message field |
| crates/fluss/src/row/datum.rs | Updated RowConvertError instantiations to use struct variant |
| crates/fluss/src/io/*.rs | Updated error instantiations to structured format with descriptive messages |
| crates/fluss/src/client/**/*.rs | Updated all error handling to use new structured error variants |
| crates/fluss/tests/integration/admin.rs | Added test_fluss_error_response test to verify API error handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d5be2d4 to
4dc0b7d
Compare
4dc0b7d to
5a895a4
Compare
5a895a4 to
29493b4
Compare
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.
Purpose
Linked issue: close #63
Brief change log
Tests
API and Format
Documentation