@Immutable public final class Status extends Object
Span by providing a standard Status.CanonicalCode in conjunction
with an optional descriptive message. Instances of Status are created by starting with
the template for the appropriate Status.CanonicalCode and supplementing it with
additional information: Status.NOT_FOUND.withDescription("Could not find
'important_file.txt'");| Modifier and Type | Class and Description |
|---|---|
static class |
Status.CanonicalCode
The set of canonical status codes.
|
| Modifier and Type | Field and Description |
|---|---|
static Status |
ABORTED
The operation was aborted, typically due to a concurrency issue like sequencer check failures,
transaction aborts, etc.
|
static Status |
ALREADY_EXISTS
Some entity that we attempted to create (e.g., file or directory) already exists.
|
static Status |
CANCELLED
The operation was cancelled (typically by the caller).
|
static Status |
DATA_LOSS
Unrecoverable data loss or corruption.
|
static Status |
DEADLINE_EXCEEDED
Deadline expired before operation could complete.
|
static Status |
FAILED_PRECONDITION
Operation was rejected because the system is not in a state required for the operation's
execution.
|
static Status |
INTERNAL
Internal errors.
|
static Status |
INVALID_ARGUMENT
Client specified an invalid argument.
|
static Status |
NOT_FOUND
Some requested entity (e.g., file or directory) was not found.
|
static Status |
OK
The operation completed successfully.
|
static Status |
OUT_OF_RANGE
Operation was attempted past the valid range.
|
static Status |
PERMISSION_DENIED
The caller does not have permission to execute the specified operation.
|
static Status |
RESOURCE_EXHAUSTED
Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system
is out of space.
|
static Status |
UNAUTHENTICATED
The request does not have valid authentication credentials for the operation.
|
static Status |
UNAVAILABLE
The service is currently unavailable.
|
static Status |
UNIMPLEMENTED
Operation is not implemented or not supported/enabled in this service.
|
static Status |
UNKNOWN
Unknown error.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Equality on Statuses is not well defined.
|
Status.CanonicalCode |
getCanonicalCode()
Returns the canonical status code.
|
String |
getDescription()
Returns the description of this
Status for human consumption. |
int |
hashCode()
Hash codes on Statuses are not well defined.
|
boolean |
isOk()
Returns
true if this Status is OK, i.e., not an error. |
String |
toString() |
Status |
withDescription(String description)
Creates a derived instance of
Status with the given description. |
public static final Status OK
public static final Status CANCELLED
public static final Status UNKNOWN
Status.CanonicalCode.UNKNOWN.public static final Status INVALID_ARGUMENT
Status.CanonicalCode.INVALID_ARGUMENT.public static final Status DEADLINE_EXCEEDED
Status.CanonicalCode.DEADLINE_EXCEEDED.public static final Status NOT_FOUND
public static final Status ALREADY_EXISTS
public static final Status PERMISSION_DENIED
Status.CanonicalCode.PERMISSION_DENIED.public static final Status UNAUTHENTICATED
public static final Status RESOURCE_EXHAUSTED
public static final Status FAILED_PRECONDITION
Status.CanonicalCode.FAILED_PRECONDITION.public static final Status ABORTED
Status.CanonicalCode.ABORTED.public static final Status OUT_OF_RANGE
Status.CanonicalCode.OUT_OF_RANGE.public static final Status UNIMPLEMENTED
public static final Status INTERNAL
Status.CanonicalCode.INTERNAL.public static final Status UNAVAILABLE
Status.CanonicalCode.UNAVAILABLE.public static final Status DATA_LOSS
public Status withDescription(@Nullable String description)
Status with the given description.description - the new description of the Status.Status with the given description.public Status.CanonicalCode getCanonicalCode()
@Nullable public String getDescription()
Status for human consumption.Status.public boolean isOk()
true if this Status is OK, i.e., not an error.true if this Status is OK.public boolean equals(@Nullable Object obj)
getCanonicalCode(). The description of the Status is unlikely to be stable, and
additional fields may be added to Status in the future.public int hashCode()
hashCode in class Objectequals(java.lang.Object)