public final class GrpcStatus
extends java.lang.Object
GrpcStatusCode
Constructor and Description |
---|
GrpcStatus(GrpcStatusCode code)
Constructs a status with no cause or description.
|
GrpcStatus(GrpcStatusCode code,
java.lang.Throwable cause)
Constructs a status with cause but no additional description.
|
GrpcStatus(GrpcStatusCode code,
java.lang.Throwable cause,
java.lang.CharSequence description)
Constructs a status with cause and additional description.
|
Modifier and Type | Method and Description |
---|---|
GrpcStatusException |
asException()
Returns the current status wrapped in a
GrpcStatusException . |
GrpcStatusException |
asException(java.util.function.Supplier<com.google.rpc.Status> applicationStatusSupplier)
Returns the current status wrapped in a
GrpcStatusException including the supplied details. |
java.lang.Throwable |
cause()
Returns the cause, can be null.
|
GrpcStatusCode |
code()
Returns the status code.
|
java.lang.String |
description()
Returns additional descriptions, can be null.
|
boolean |
equals(java.lang.Object o) |
static GrpcStatus |
fromCodeValue(int codeValue)
Obtains the status given an integer code value.
|
static GrpcStatus |
fromCodeValue(java.lang.String codeValue)
Obtains the status given a code value string.
|
static GrpcStatus |
fromThrowable(java.lang.Throwable t)
Translates a throwable into a status.
|
static GrpcStatus |
fromThrowableNullable(java.lang.Throwable t)
Translates a throwable into a status.
|
int |
hashCode() |
java.lang.String |
toString() |
public GrpcStatus(GrpcStatusCode code)
code
- status code.public GrpcStatus(GrpcStatusCode code, @Nullable java.lang.Throwable cause)
code
- status code.cause
- cause.public GrpcStatus(GrpcStatusCode code, @Nullable java.lang.Throwable cause, @Nullable java.lang.CharSequence description)
code
- status code.cause
- cause.description
- additional description.public static GrpcStatus fromCodeValue(java.lang.String codeValue)
codeValue
- code value string.GrpcStatusCode.UNKNOWN
.public static GrpcStatus fromCodeValue(int codeValue)
codeValue
- integer code value.GrpcStatusCode.UNKNOWN
.public static GrpcStatus fromThrowable(java.lang.Throwable t)
t
- the throwable.GrpcStatusException
, or an GrpcStatusCode.UNKNOWN
status with the throwable as the cause.@Nullable public static GrpcStatus fromThrowableNullable(java.lang.Throwable t)
t
- the throwable.GrpcStatusException
, or null
.public GrpcStatusException asException()
GrpcStatusException
.GrpcStatusException
.public GrpcStatusException asException(java.util.function.Supplier<com.google.rpc.Status> applicationStatusSupplier)
GrpcStatusException
including the supplied details.
The status code used by Status
and the one of the GrpcStatus
must be the same.
Users should usually use GrpcStatusException.of(Status)
.applicationStatusSupplier
- the Supplier
for the Status
.GrpcStatusException
.public GrpcStatusCode code()
@Nullable public java.lang.Throwable cause()
@Nullable public java.lang.String description()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object