tustvold commented on code in PR #5439:
URL: https://github.com/apache/arrow-rs/pull/5439#discussion_r1506928267


##########
arrow-flight/src/error.rs:
##########
@@ -49,17 +49,24 @@ impl FlightError {
 
 impl std::fmt::Display for FlightError {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        // TODO better format / error
-        write!(f, "{self:?}")
+        match self {
+            FlightError::Arrow(inner) => inner.fmt(f),
+            FlightError::NotYetImplemented(desc) => write!(f, "Not yet 
implemented: {}", desc),
+            FlightError::Tonic(inner) => inner.fmt(f),
+            FlightError::ProtocolError(desc) => write!(f, "Protocol error: 
{}", desc),
+            FlightError::DecodeError(desc) => write!(f, "Decode error: {}", 
desc),
+            FlightError::ExternalError(source) => write!(f, "External error: 
{}", source),
+        }
     }
 }
 
 impl Error for FlightError {
     fn source(&self) -> Option<&(dyn Error + 'static)> {
-        if let Self::ExternalError(e) = self {
-            Some(e.as_ref())
-        } else {
-            None
+        match self {
+            FlightError::Arrow(inner) => inner.source(),
+            FlightError::Tonic(inner) => inner.source(),

Review Comment:
   ```suggestion
               FlightError::Arrow(inner) => inner,
               FlightError::Tonic(inner) => inner,
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to