impl(gax): refactor SendError to use BoxError - #6475
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors SendError in the gax crate by removing internal helper methods, simplifying the enum variants, and implementing From<SendError> for crate::error::Error. The review feedback recommends preserving the underlying serialization error details in the Display representation of SendError::Serialization to ensure errors remain actionable and easy to debug, in line with the repository's style guide.
375116a to
ea4a33b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6475 +/- ##
=======================================
Coverage 96.38% 96.38%
=======================================
Files 298 298
Lines 84328 84317 -11
=======================================
- Hits 81280 81273 -7
+ Misses 3048 3044 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
coryan
left a comment
There was a problem hiding this comment.
Is this still needed if we don't change the examples?
Add SendError::into_error to explicitly convert a SendError into a
gax::error::Error without implementing the From trait.
Hmmm.... I am not sure "without implementing the From trait" is a win....
When I tried to implement From I got all sorts of errors across our crates that it could no longer determine which type something was. It is totally possible this isn't a big deal and I just didn't look into it closely enough and there was a simple fix (I did not look that hard for one). I will remove the conversion since its unneeded and can look into whether we can implement From without breaking anything, because that is what I wanted to do at first. |
Refactor SendError in google-cloud-gax to capture BoxError directly in the Serialization variant instead of wrapping crate::error::Error. Remove temporary stream_closed and ser constructors now that construction is handled directly via SendError::StreamClosed and SendError::Serialization.
…essage
Format SendError::Serialization with {0} to preserve the underlying
error details in Display output.
Add SendError::into_error to explicitly convert a SendError into a gax::error::Error without implementing the From trait.
ee76b5e to
8018a86
Compare
Refactor SendError in google-cloud-gax to capture BoxError directly in the Serialization variant instead of wrapping crate::error::Error.
Remove temporary stream_closed and ser constructors now that construction is handled directly via SendError::StreamClosed and SendError::Serialization. These were intended to make refactoring the error type easier, but I have decided to keep an enum instead of doing an opaque struct with an internal SendErrorKind.