cyb70289 commented on code in PR #12749:
URL: https://github.com/apache/arrow/pull/12749#discussion_r849020058
##########
cpp/src/arrow/flight/transport.cc:
##########
@@ -159,6 +160,198 @@ TransportRegistry* GetDefaultTransportRegistry() {
return &kRegistry;
}
+//------------------------------------------------------------
+// Error propagation helpers
+
+TransportStatus TransportStatus::FromStatus(const Status& arrow_status) {
+ if (arrow_status.ok()) {
+ return TransportStatus{TransportStatusCode::kOk, ""};
+ }
+
+ TransportStatusCode code = TransportStatusCode::kUnknown;
+ std::string message = arrow_status.message();
+ if (arrow_status.detail()) {
+ message += ". Detail: ";
+ message += arrow_status.detail()->ToString();
+ }
+
+ std::shared_ptr<FlightStatusDetail> flight_status =
+ FlightStatusDetail::UnwrapStatus(arrow_status);
+ if (flight_status) {
+ switch (flight_status->code()) {
+ case FlightStatusCode::Internal:
+ code = TransportStatusCode::kInternal;
+ break;
Review Comment:
We have `Status`, `FlightStatusDetail`, `TransportStatus` and according code
definitions. Looks to me `FlightStatusDetail` and `TransportStatus` are
similar. Why we need them both?
--
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]