public class StatusUtils extends Object
NOT A PUBLIC CLASS, interface is not guaranteed to remain stable.
Modifier and Type | Method and Description |
---|---|
static FlightRuntimeException |
fromGrpcRuntimeException(io.grpc.StatusRuntimeException sre)
Convert from a gRPC exception to a Flight exception.
|
static CallStatus |
fromGrpcStatus(io.grpc.Status status)
Convert from a gRPC status to a Flight status.
|
static CallStatus |
fromGrpcStatusAndTrailers(io.grpc.Status status,
io.grpc.Metadata trailers)
Convert from a gRPC Status & trailers to a Flight status.
|
static FlightStatusCode |
fromGrpcStatusCode(io.grpc.Status.Code code)
Convert from a gRPC status code to a Flight status code.
|
static FlightRuntimeException |
fromThrowable(Throwable t)
Convert arbitrary exceptions to a
FlightRuntimeException . |
static Throwable |
toGrpcException(Throwable ex)
Convert arbitrary exceptions to a
StatusRuntimeException or StatusException . |
static io.grpc.Status |
toGrpcStatus(CallStatus status)
Convert from a Flight status to a gRPC status.
|
static io.grpc.Status.Code |
toGrpcStatusCode(FlightStatusCode code)
Convert from a Flight status code to a gRPC status code.
|
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 . |
public static io.grpc.Status.Code toGrpcStatusCode(FlightStatusCode code)
public static FlightStatusCode fromGrpcStatusCode(io.grpc.Status.Code code)
public static CallStatus fromGrpcStatusAndTrailers(io.grpc.Status status, io.grpc.Metadata trailers)
public static CallStatus fromGrpcStatus(io.grpc.Status status)
public static io.grpc.Status toGrpcStatus(CallStatus status)
public static FlightRuntimeException fromGrpcRuntimeException(io.grpc.StatusRuntimeException sre)
public static FlightRuntimeException fromThrowable(Throwable t)
FlightRuntimeException
.public static Throwable toGrpcException(Throwable ex)
StatusRuntimeException
or StatusException
.
Such exceptions can be passed to StreamObserver.onError(Throwable)
and will give the client
a reasonable error message.
public static <FROM,TO> Iterator<TO> wrapIterator(Iterator<FROM> fromIterator, Function<? super FROM,? extends TO> transformer)
FlightRuntimeException
.Copyright © 2023 The Apache Software Foundation. All rights reserved.