Enum Class ErrorCode
- All Implemented Interfaces:
Serializable,Comparable<ErrorCode>,Constable
Canonical error codes shared by every Grow Codes SDK (SPEC section 2.1).
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionHTTP 401: missing or invalid credentials.The caller cancelled the operation.Invalid or missing configuration.HTTP 409, 412 or a check-and-set mismatch.HTTP 404 or a missing record.HTTP 403: the credentials lack a permission.HTTP 429.Connect, request or total deadline exceeded, HTTP 408 or 504.Network error or HTTP 500, 502, 503.A capability the service or deployment does not offer (HTTP 501).HTTP 400, 413, 422, other 4xx or bad input caught client side. -
Method Summary
Modifier and TypeMethodDescriptionstatic ErrorCodeforStatus(int status) Maps an HTTP status to its canonical code.Returns the code of an SDK exception.booleanReturns whether errors with this code are retryable by default.static ErrorCodeReturns the enum constant of this class with the specified name.static ErrorCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.Returns the wire value used in conformance scenarios and JSON.
-
Enum Constant Details
-
CONFIG
Invalid or missing configuration. -
AUTHENTICATION
HTTP 401: missing or invalid credentials. -
PERMISSION_DENIED
HTTP 403: the credentials lack a permission. -
NOT_FOUND
HTTP 404 or a missing record. -
CONFLICT
HTTP 409, 412 or a check-and-set mismatch. -
RATE_LIMITED
HTTP 429. -
VALIDATION
HTTP 400, 413, 422, other 4xx or bad input caught client side. -
UNAVAILABLE
Network error or HTTP 500, 502, 503. -
TIMEOUT
Connect, request or total deadline exceeded, HTTP 408 or 504. -
UNSUPPORTED
A capability the service or deployment does not offer (HTTP 501). -
CANCELLED
The caller cancelled the operation.
-
-
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
-
retryable
public boolean retryable()Returns whether errors with this code are retryable by default.- Returns:
- true for
RATE_LIMITED,UNAVAILABLEandTIMEOUT
-
wireValue
Returns the wire value used in conformance scenarios and JSON.- Returns:
- the upper-case wire value, e.g.
NOT_FOUND
-
of
Returns the code of an SDK exception.- Parameters:
error- any throwable- Returns:
- the code when
erroris an SDK exception, else empty
-
forStatus
Maps an HTTP status to its canonical code.- Parameters:
status- HTTP status code (4xx or 5xx)- Returns:
- the code per SPEC section 2.1
-