public final class GrpcStatus
extends Object
GrpcStatusCode| Constructor and Description |
|---|
GrpcStatus(GrpcStatusCode code)
Constructs a status with no cause or description.
|
GrpcStatus(GrpcStatusCode code,
Throwable cause)
Constructs a status with cause but no additional description.
|
GrpcStatus(GrpcStatusCode code,
Throwable cause,
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(Supplier<Status> applicationStatusSupplier)
Returns the current status wrapped in a
GrpcStatusException including the supplied details. |
Throwable |
cause()
Returns the cause, can be null.
|
GrpcStatusCode |
code()
Returns the status code.
|
String |
description()
Returns additional descriptions, can be null.
|
boolean |
equals(Object o) |
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 |
fromThrowable(Throwable t)
Translates a throwable into a status.
|
static GrpcStatus |
fromThrowableNullable(Throwable t)
Translates a throwable into a status.
|
int |
hashCode() |
String |
toString() |
public GrpcStatus(GrpcStatusCode code)
code - status code.public GrpcStatus(GrpcStatusCode code, @Nullable Throwable cause)
code - status code.cause - cause.public GrpcStatus(GrpcStatusCode code, @Nullable Throwable cause, @Nullable CharSequence description)
code - status code.cause - cause.description - additional description.public static GrpcStatus fromCodeValue(String codeValue)
codeValue - code value string.GrpcStatusCode.UNKNOWN.public static GrpcStatus fromCodeValue(int codeValue)
codeValue - integer code value.GrpcStatusCode.UNKNOWN.public static GrpcStatus fromThrowable(Throwable t)
t - the throwable.GrpcStatusException, or an GrpcStatusCode.UNKNOWN
status with the throwable as the cause.@Nullable public static GrpcStatus fromThrowableNullable(Throwable t)
t - the throwable.GrpcStatusException, or null.public GrpcStatusException asException()
GrpcStatusException.GrpcStatusException.public GrpcStatusException asException(Supplier<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 Throwable cause()
@Nullable public String description()
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object