Package io.servicetalk.grpc.api
Enum Class GrpcStatusCode
- All Implemented Interfaces:
Serializable
,Comparable<GrpcStatusCode>
,Constable
Standard gRPC status codes.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionAborted, typically due to a concurrency issue (think CAS).Some entity that we attempted to create already exists.Cancelled (typically by caller).Data corruption.Deadline expired.The action cannot be executed on the current system state.Internal invariant violated.Client specified an invalid argument.Some requested entity not found.Successful.Used for range errors (e.g.Permission denied for a particular client.Resource exhausted.Cannot authenticate the client.Service unavailable, similar to 503, client may retry.The method/operation is not implemented/supported.Unknown error. -
Method Summary
Modifier and TypeMethodDescriptionstatic GrpcStatusCode
fromCodeValue
(int codeValue) Obtains the status code given an integer code value.static GrpcStatusCode
fromCodeValue
(CharSequence codeValue) Obtains the status code given a code value.static GrpcStatusCode
fromHttp2ErrorCode
(Http2ErrorCode errorCode) Convert fromHttp2ErrorCode
toGrpcStatus
.status()
Returns a standardGrpcStatus
with this status code.int
value()
Returns the integer code value.static GrpcStatusCode
Returns the enum constant of this class with the specified name.static GrpcStatusCode[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
OK
Successful. -
CANCELLED
Cancelled (typically by caller). -
UNKNOWN
Unknown error. -
INVALID_ARGUMENT
Client specified an invalid argument. -
DEADLINE_EXCEEDED
Deadline expired. -
NOT_FOUND
Some requested entity not found. -
ALREADY_EXISTS
Some entity that we attempted to create already exists. -
PERMISSION_DENIED
Permission denied for a particular client. Must not be used for the following cases:- rejections caused by exhausting some resource (use
RESOURCE_EXHAUSTED
instead) - the caller cannot be identified (use
UNAUTHENTICATED
instead)
- rejections caused by exhausting some resource (use
-
RESOURCE_EXHAUSTED
Resource exhausted. -
FAILED_PRECONDITION
The action cannot be executed on the current system state. Client should not retry. -
ABORTED
Aborted, typically due to a concurrency issue (think CAS). Client may retry the whole sequence. -
OUT_OF_RANGE
Used for range errors (e.g. seeking or reading past end of file.)Unlike
INVALID_ARGUMENT
, this error indicates a problem that may be fixed if the system state changes. For example, a 32-bit file system will generateINVALID_ARGUMENT
if asked to read at an offset that is not in the range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from an offset past the current file size.There is a fair bit of overlap with
FAILED_PRECONDITION
. This error is more specific and recommended in scenarios when callers who are iterating through a space can easily look for an OUT_OF_RANGE error to detect when they are done. -
UNIMPLEMENTED
The method/operation is not implemented/supported. -
INTERNAL
Internal invariant violated. -
UNAVAILABLE
Service unavailable, similar to 503, client may retry. -
DATA_LOSS
Data corruption. -
UNAUTHENTICATED
Cannot authenticate the client.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
fromCodeValue
Obtains the status code given a code value.- Parameters:
codeValue
- code value.- Returns:
- status code associated with the code value, or
UNKNOWN
.
-
fromCodeValue
Obtains the status code given an integer code value.- Parameters:
codeValue
- integer code value.- Returns:
- status code associated with the code value, or
UNKNOWN
.
-
value
public int value()Returns the integer code value.- Returns:
- the integer code value.
-
status
Returns a standardGrpcStatus
with this status code.- Returns:
- a standard
GrpcStatus
with this status code.
-
fromHttp2ErrorCode
Convert fromHttp2ErrorCode
toGrpcStatus
.- Parameters:
errorCode
- theHttp2ErrorCode
to convert.- Returns:
- the result of the conversion.
-