Package io.servicetalk.grpc.api
Class GrpcStatus
java.lang.Object
io.servicetalk.grpc.api.GrpcStatus
Class representing gRPC statuses.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGrpcStatus
(GrpcStatusCode code) Constructs a status with no cause or description.GrpcStatus
(GrpcStatusCode code, String description) Constructs a status with cause and additional description.GrpcStatus
(GrpcStatusCode code, Throwable cause) Deprecated.GrpcStatus
(GrpcStatusCode code, Throwable cause, CharSequence description) Deprecated.UseGrpcStatusException
if there is a cause orGrpcStatus(GrpcStatusCode, String)
. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.asException
(Supplier<com.google.rpc.Status> applicationStatusSupplier) Deprecated.cause()
Deprecated.UseGrpcStatusException.fromThrowable(Throwable)
to create aGrpcStatusException
thenThrowable.getCause()
.code()
Returns the status code.Returns additional descriptions, can be null.boolean
static GrpcStatus
fromCodeValue
(int codeValue) Obtains the status given an integer code value.static GrpcStatus
fromCodeValue
(String codeValue) Obtains the status given a code value string.static GrpcStatus
Deprecated.static GrpcStatus
Deprecated.int
hashCode()
toString()
-
Constructor Details
-
GrpcStatus
Constructs a status with no cause or description.- Parameters:
code
- status code.
-
GrpcStatus
Deprecated.UseGrpcStatusException
if there is aThrowable
cause.Constructs a status with cause but no additional description.- Parameters:
code
- status code.cause
- cause.
-
GrpcStatus
@Deprecated public GrpcStatus(GrpcStatusCode code, @Nullable Throwable cause, @Nullable CharSequence description) Deprecated.UseGrpcStatusException
if there is a cause orGrpcStatus(GrpcStatusCode, String)
.Constructs a status with cause and additional description.- Parameters:
code
- status code.cause
- cause.description
- additional description.
-
GrpcStatus
Constructs a status with cause and additional description.- Parameters:
code
- status code.description
- additional description.
-
-
Method Details
-
fromCodeValue
Obtains the status given a code value string.- Parameters:
codeValue
- code value string.- Returns:
- status associated with the code value, or
GrpcStatusCode.UNKNOWN
.
-
fromCodeValue
Obtains the status given an integer code value.- Parameters:
codeValue
- integer code value.- Returns:
- status associated with the code value, or
GrpcStatusCode.UNKNOWN
.
-
fromThrowable
Deprecated.Translates a throwable into a status.- Parameters:
t
- the throwable.- Returns:
- embedded status if the throwable is a
GrpcStatusException
, or anGrpcStatusCode.UNKNOWN
status with the throwable as the cause.
-
fromThrowableNullable
Deprecated.Translates a throwable into a status.- Parameters:
t
- the throwable.- Returns:
- embedded status if the throwable is a
GrpcStatusException
, ornull
.
-
asException
Deprecated.Returns the current status wrapped in aGrpcStatusException
.- Returns:
- the current status wrapped in a
GrpcStatusException
.
-
asException
@Deprecated public GrpcStatusException asException(Supplier<com.google.rpc.Status> applicationStatusSupplier) Deprecated.Returns the current status wrapped in aGrpcStatusException
including the supplied details. The status code used byStatus
and the one of theGrpcStatus
must be the same. Users should usually useGrpcStatusException.of(Status)
.- Parameters:
applicationStatusSupplier
- theSupplier
for theStatus
.- Returns:
- the current status wrapped in a
GrpcStatusException
.
-
code
Returns the status code.- Returns:
- the status code.
-
cause
Deprecated.UseGrpcStatusException.fromThrowable(Throwable)
to create aGrpcStatusException
thenThrowable.getCause()
.Returns the cause, can be null.- Returns:
- the cause, can be null.
-
description
Returns additional descriptions, can be null.- Returns:
- additional descriptions, can be null.
-
equals
-
hashCode
public int hashCode() -
toString
-
GrpcStatusException
if there is aThrowable
cause.