cpp/src/arrow/flight/internal.cc
/// Convert an Arrow status to a gRPC status.
Convert an Arrow status to a gRPC status.
Convert an Arrow status to a gRPC status .
static grpc::Status ToRawGrpcStatus(const Status& arrow_status) {
  if (arrow_status.ok()) {
    return grpc::Status::OK;
  }
  grpc::StatusCode grpc_code = grpc::StatusCode::UNKNOWN;
  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:
        grpc_code = grpc::StatusCode::INTERNAL;
        break;
      case FlightStatusCode::TimedOut:
        grpc_code = grpc::StatusCode::DEADLINE_EXCEEDED;
        break;
      case FlightStatusCode::Cancelled:
        grpc_code = grpc::StatusCode::CANCELLED;
        break;
      case FlightStatusCode::Unauthenticated:
        grpc_code = grpc::StatusCode::UNAUTHENTICATED;
        break;
      case FlightStatusCode::Unauthorized:
        grpc_code = grpc::StatusCode::PERMISSION_DENIED;
        break;
      case FlightStatusCode::Unavailable:
        grpc_code = grpc::StatusCode::UNAVAILABLE;
        break;
      default:
        break;
    }
  } else if (arrow_status.IsNotImplemented()) {
    grpc_code = grpc::StatusCode::UNIMPLEMENTED;
  } else if (arrow_status.IsInvalid()) {
    grpc_code = grpc::StatusCode::INVALID_ARGUMENT;
  } else if (arrow_status.IsKeyError()) {
    grpc_code = grpc::StatusCode::NOT_FOUND;
  } else if (arrow_status.IsAlreadyExists()) {
    grpc_code = grpc::StatusCode::ALREADY_EXISTS;
  }
  return grpc::Status(grpc_code, message);
}
static grpc :: Status ToRawGrpcStatus ( const Status & arrow_status ) { if ( arrow_status . ok ( ) ) { return grpc :: Status :: OK ; } grpc :: StatusCode grpc_code = grpc :: StatusCode :: UNKNOWN ; std :: string message = arrow_status . message ( ) ; if ( arrow_status . detail ( ) ) { message += " " ; 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 : grpc_code = grpc :: StatusCode :: INTERNAL ; break ; case FlightStatusCode :: TimedOut : grpc_code = grpc :: StatusCode :: DEADLINE_EXCEEDED ; break ; case FlightStatusCode :: Cancelled : grpc_code = grpc :: StatusCode :: CANCELLED ; break ; case FlightStatusCode :: Unauthenticated : grpc_code = grpc :: StatusCode :: UNAUTHENTICATED ; break ; case FlightStatusCode :: Unauthorized : grpc_code = grpc :: StatusCode :: PERMISSION_DENIED ; break ; case FlightStatusCode :: Unavailable : grpc_code = grpc :: StatusCode :: UNAVAILABLE ; break ; default : break ; } } else if ( arrow_status . IsNotImplemented ( ) ) { grpc_code = grpc :: StatusCode :: UNIMPLEMENTED ; } else if ( arrow_status . IsInvalid ( ) ) { grpc_code = grpc :: StatusCode :: INVALID_ARGUMENT ; } else if ( arrow_status . IsKeyError ( ) ) { grpc_code = grpc :: StatusCode :: NOT_FOUND ; } else if ( arrow_status . IsAlreadyExists ( ) ) { grpc_code = grpc :: StatusCode :: ALREADY_EXISTS ; } return grpc :: Status ( grpc_code , message ) ; }
Convert an Arrow status to a gRPC status.
Convert an Arrow status to a gRPC status .