public class CallStatus extends Object
If raised or sent through FlightProducer.StreamListener.onError(Throwable)
or
OutboundStreamListener.error(Throwable)
, the client call will raise the same error (a
FlightRuntimeException
with the same FlightStatusCode
and description). The exception within, if
present, will not be sent to the client.
Modifier and Type | Field and Description |
---|---|
static CallStatus |
ALREADY_EXISTS |
static CallStatus |
CANCELLED |
static CallStatus |
INTERNAL |
static CallStatus |
INVALID_ARGUMENT |
static CallStatus |
NOT_FOUND |
static CallStatus |
TIMED_OUT |
static CallStatus |
UNAUTHENTICATED |
static CallStatus |
UNAUTHORIZED |
static CallStatus |
UNAVAILABLE |
static CallStatus |
UNIMPLEMENTED |
static CallStatus |
UNKNOWN |
Constructor and Description |
---|
CallStatus(FlightStatusCode code)
Create a new status with no cause or description.
|
CallStatus(FlightStatusCode code,
Throwable cause,
String description,
ErrorFlightMetadata metadata)
Create a new status.
|
Modifier and Type | Method and Description |
---|---|
Throwable |
cause()
The exception that led to this result.
|
FlightStatusCode |
code()
The status code describing the result of the RPC.
|
String |
description()
A description of the result.
|
ErrorFlightMetadata |
metadata()
Metadata associated with the exception.
|
FlightRuntimeException |
toRuntimeException()
Convert the status to an equivalent exception.
|
String |
toString() |
CallStatus |
withCause(Throwable t)
Return a copy of this status with the given exception as the cause.
|
CallStatus |
withDescription(String message)
Return a copy of this status with an error message.
|
CallStatus |
withMetadata(ErrorFlightMetadata metadata)
Return a copy of this status with associated exception metadata.
|
public static final CallStatus UNKNOWN
public static final CallStatus INTERNAL
public static final CallStatus INVALID_ARGUMENT
public static final CallStatus TIMED_OUT
public static final CallStatus NOT_FOUND
public static final CallStatus ALREADY_EXISTS
public static final CallStatus CANCELLED
public static final CallStatus UNAUTHENTICATED
public static final CallStatus UNAUTHORIZED
public static final CallStatus UNIMPLEMENTED
public static final CallStatus UNAVAILABLE
public CallStatus(FlightStatusCode code, Throwable cause, String description, ErrorFlightMetadata metadata)
code
- The status code.cause
- An exception that resulted in this status (or null).description
- A description of the status (or null).public CallStatus(FlightStatusCode code)
code
- The status code.public FlightStatusCode code()
public Throwable cause()
public String description()
public ErrorFlightMetadata metadata()
public CallStatus withDescription(String message)
public CallStatus withCause(Throwable t)
public CallStatus withMetadata(ErrorFlightMetadata metadata)
public FlightRuntimeException toRuntimeException()
Copyright © 2023 The Apache Software Foundation. All rights reserved.