MCPcopy Create free account
hub / github.com/apache/arrow / FromStatus

Method FromStatus

cpp/src/arrow/flight/transport.cc:187–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185// Error propagation helpers
186
187TransportStatus TransportStatus::FromStatus(const Status& arrow_status) {
188 if (arrow_status.ok()) {
189 return TransportStatus{TransportStatusCode::kOk, ""};
190 }
191
192 TransportStatusCode code = TransportStatusCode::kUnknown;
193 std::string message = arrow_status.message();
194 if (arrow_status.detail()) {
195 message += ". Detail: ";
196 message += arrow_status.detail()->ToString();
197 }
198
199 std::shared_ptr<FlightStatusDetail> flight_status =
200 FlightStatusDetail::UnwrapStatus(arrow_status);
201 if (flight_status) {
202 switch (flight_status->code()) {
203 case FlightStatusCode::Internal:
204 code = TransportStatusCode::kInternal;
205 break;
206 case FlightStatusCode::TimedOut:
207 code = TransportStatusCode::kTimedOut;
208 break;
209 case FlightStatusCode::Cancelled:
210 code = TransportStatusCode::kCancelled;
211 break;
212 case FlightStatusCode::Unauthenticated:
213 code = TransportStatusCode::kUnauthenticated;
214 break;
215 case FlightStatusCode::Unauthorized:
216 code = TransportStatusCode::kUnauthorized;
217 break;
218 case FlightStatusCode::Unavailable:
219 code = TransportStatusCode::kUnavailable;
220 break;
221 default:
222 break;
223 }
224 } else if (arrow_status.IsKeyError()) {
225 code = TransportStatusCode::kNotFound;
226 } else if (arrow_status.IsInvalid()) {
227 code = TransportStatusCode::kInvalidArgument;
228 } else if (arrow_status.IsCancelled()) {
229 code = TransportStatusCode::kCancelled;
230 } else if (arrow_status.IsNotImplemented()) {
231 code = TransportStatusCode::kUnimplemented;
232 } else if (arrow_status.IsAlreadyExists()) {
233 code = TransportStatusCode::kAlreadyExists;
234 }
235 return TransportStatus{code, std::move(message)};
236}
237
238TransportStatus TransportStatus::FromCodeStringAndMessage(const std::string& code_str,
239 std::string message) {

Callers

nothing calls this directly

Calls 4

IsCancelledMethod · 0.80
okMethod · 0.45
ToStringMethod · 0.45
codeMethod · 0.45

Tested by

no test coverage detected