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.UseGrpcStatusExceptionif 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 aGrpcStatusExceptionthenThrowable.getCause().code()Returns the status code.Returns additional descriptions, can be null.booleanstatic GrpcStatusfromCodeValue(int codeValue) Obtains the status given an integer code value.static GrpcStatusfromCodeValue(String codeValue) Obtains the status given a code value string.static GrpcStatusDeprecated.static GrpcStatusDeprecated.inthashCode()toString()
-
Constructor Details
-
GrpcStatus
Constructs a status with no cause or description.- Parameters:
code- status code.
-
GrpcStatus
Deprecated.UseGrpcStatusExceptionif there is aThrowablecause.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.UseGrpcStatusExceptionif 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.UNKNOWNstatus 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 aGrpcStatusExceptionincluding the supplied details. The status code used byStatusand the one of theGrpcStatusmust be the same. Users should usually useGrpcStatusException.of(Status).- Parameters:
applicationStatusSupplier- theSupplierfor 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 aGrpcStatusExceptionthenThrowable.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
-
GrpcStatusExceptionif there is aThrowablecause.