Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pilota): support clone for transport exception #230

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pilota/src/thrift/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub use transport::*;
/// processing. It is a catch-all for errors that occur in the Thrift
/// runtime, including errors from the protocol, transport, and application
/// layers.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum ThriftException {
/// Errors encountered within auto-generated code, or when incoming
/// or outgoing messages violate the Thrift spec.
Expand Down
11 changes: 11 additions & 0 deletions pilota/src/thrift/error/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,14 @@ impl std::error::Error for TransportException {
Some(&self.io_error)
}
}

impl Clone for TransportException {
fn clone(&self) -> Self {
Self {
// TODO: io::Error doesn't support clone, we can only clone in this way now.
// Investigate how to do this in the future.
io_error: io::Error::new(self.io_error().kind(), self.io_error().to_string()),
message: self.message.clone(),
}
}
}
Loading