Skip to content

chore: Improve error#77

Merged
luoyuxia merged 2 commits into
apache:mainfrom
luoyuxia:improve-error
Dec 20, 2025
Merged

chore: Improve error#77
luoyuxia merged 2 commits into
apache:mainfrom
luoyuxia:improve-error

Conversation

@luoyuxia
Copy link
Copy Markdown
Contributor

@luoyuxia luoyuxia commented Dec 7, 2025

Purpose

Linked issue: close #63

Brief change log

Tests

API and Format

Documentation

@luoyuxia luoyuxia force-pushed the improve-error branch 3 times, most recently from caa5139 to adf9eb9 Compare December 13, 2025 09:15
@luoyuxia luoyuxia requested a review from Copilot December 13, 2025 09:16
Copy link
Copy Markdown

Copilot AI left a comment

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 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 thiserror to snafu with structured error variants containing message and source fields
  • Implemented Fluss API error protocol by adding FlussError enum, ApiError struct, 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.

Comment thread crates/fluss/tests/integration/admin.rs Outdated
Comment thread crates/fluss/tests/integration/admin.rs Outdated
Comment thread crates/fluss/src/rpc/fluss_api_error.rs Outdated
Comment thread crates/fluss/src/rpc/fluss_api_error.rs Outdated
Comment thread crates/fluss/src/rpc/fluss_api_error.rs Outdated
Comment thread crates/fluss/src/rpc/fluss_api_error.rs Outdated
Comment thread crates/fluss/src/rpc/fluss_api_error.rs Outdated
Comment thread crates/fluss/src/io/storage.rs Outdated
Comment thread crates/fluss/src/error.rs Outdated
@luoyuxia luoyuxia force-pushed the improve-error branch 4 times, most recently from d5be2d4 to 4dc0b7d Compare December 15, 2025 11:51
@luoyuxia luoyuxia merged commit 4e10d63 into apache:main Dec 20, 2025
13 checks passed
@luoyuxia luoyuxia deleted the improve-error branch December 20, 2025 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve code to make it robust

2 participants