@ExperimentalApi public final class StatusProto extends Object
Status.| Modifier and Type | Method and Description |
|---|---|
static com.google.rpc.Status |
fromStatusAndTrailers(Status status,
Metadata trailers)
Extracts the google.rpc.Status from trailers, and makes sure they match the gRPC
status. |
static com.google.rpc.Status |
fromThrowable(Throwable t)
Extract a
Status instance from the causal chain of a Throwable. |
static StatusException |
toStatusException(com.google.rpc.Status statusProto)
Convert a
Status instance to a StatusException. |
static StatusException |
toStatusException(com.google.rpc.Status statusProto,
Metadata metadata)
Convert a
Status instance to a StatusException with additional
metadata. |
static StatusRuntimeException |
toStatusRuntimeException(com.google.rpc.Status statusProto)
Convert a
Status instance to a StatusRuntimeException. |
static StatusRuntimeException |
toStatusRuntimeException(com.google.rpc.Status statusProto,
Metadata metadata)
Convert a
Status instance to a StatusRuntimeException with
additional metadata. |
public static StatusRuntimeException toStatusRuntimeException(com.google.rpc.Status statusProto)
Status instance to a StatusRuntimeException.
The returned StatusRuntimeException will wrap a Status whose code and
description are set from the code and message in statusProto. statusProto will
be serialized and placed into the metadata of the returned StatusRuntimeException.
IllegalArgumentException - if the value of statusProto.getCode() is not a valid
gRPC status code.public static StatusRuntimeException toStatusRuntimeException(com.google.rpc.Status statusProto, Metadata metadata)
Status instance to a StatusRuntimeException with
additional metadata.
The returned StatusRuntimeException will wrap a Status whose code and
description are set from the code and message in statusProto. statusProto will
be serialized and added to metadata. metadata will be set as the metadata of
the returned StatusRuntimeException.
IllegalArgumentException - if the value of statusProto.getCode() is not a valid
gRPC status code.public static StatusException toStatusException(com.google.rpc.Status statusProto)
Status instance to a StatusException.
The returned StatusException will wrap a Status whose code and description
are set from the code and message in statusProto. statusProto will be
serialized and placed into the metadata of the returned StatusException.
IllegalArgumentException - if the value of statusProto.getCode() is not a valid
gRPC status code.public static StatusException toStatusException(com.google.rpc.Status statusProto, Metadata metadata)
Status instance to a StatusException with additional
metadata.
The returned StatusException will wrap a Status whose code and description
are set from the code and message in statusProto. statusProto will be
serialized and added to metadata. metadata will be set as the metadata of the
returned StatusException.
IllegalArgumentException - if the value of statusProto.getCode() is not a valid
gRPC status code.@Nullable public static com.google.rpc.Status fromThrowable(Throwable t)
Status instance from the causal chain of a Throwable.Status instance, or null if none exists.IllegalArgumentException - if an embedded Status is found and its
code does not match the gRPC Status code.