Class StatusUtils


public class StatusUtils extends Object
Utilities to adapt gRPC and Flight status objects.

NOT A PUBLIC CLASS, interface is not guaranteed to remain stable.

  • Method Details

    • toGrpcStatusCode

      public static io.grpc.Status.Code toGrpcStatusCode(FlightStatusCode code)
      Convert from a Flight status code to a gRPC status code.
    • fromGrpcStatusCode

      public static FlightStatusCode fromGrpcStatusCode(io.grpc.Status.Code code)
      Convert from a gRPC status code to a Flight status code.
    • fromGrpcStatusAndTrailers

      public static CallStatus fromGrpcStatusAndTrailers(io.grpc.Status status, io.grpc.Metadata trailers)
      Convert from a gRPC Status & trailers to a Flight status.
    • fromGrpcStatus

      public static CallStatus fromGrpcStatus(io.grpc.Status status)
      Convert from a gRPC status to a Flight status.
    • toGrpcStatus

      public static io.grpc.Status toGrpcStatus(CallStatus status)
      Convert from a Flight status to a gRPC status.
    • fromGrpcRuntimeException

      public static FlightRuntimeException fromGrpcRuntimeException(io.grpc.StatusRuntimeException sre)
      Convert from a gRPC exception to a Flight exception.
    • fromThrowable

      public static FlightRuntimeException fromThrowable(Throwable t)
      Convert arbitrary exceptions to a FlightRuntimeException.
    • toGrpcException

      public static Throwable toGrpcException(Throwable ex)
      Convert arbitrary exceptions to a StatusRuntimeException or StatusException.

      Such exceptions can be passed to StreamObserver.onError(Throwable) and will give the client a reasonable error message.

    • wrapIterator

      public static <FROM, TO> Iterator<TO> wrapIterator(Iterator<FROM> fromIterator, Function<? super FROM,? extends TO> transformer)
      Maps a transformation function to the elements of an iterator, while wrapping exceptions in FlightRuntimeException.