public static final class Status.Builder extends GeneratedMessageV3.Builder<Status.Builder> implements StatusOrBuilder
The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` that can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons.Protobuf type
google.rpc.Status
Modifier and Type | Method and Description |
---|---|
Status.Builder |
addAllDetails(java.lang.Iterable<? extends Any> values)
A list of messages that carry the error details.
|
Status.Builder |
addDetails(Any.Builder builderForValue)
A list of messages that carry the error details.
|
Status.Builder |
addDetails(Any value)
A list of messages that carry the error details.
|
Status.Builder |
addDetails(int index,
Any.Builder builderForValue)
A list of messages that carry the error details.
|
Status.Builder |
addDetails(int index,
Any value)
A list of messages that carry the error details.
|
Any.Builder |
addDetailsBuilder()
A list of messages that carry the error details.
|
Any.Builder |
addDetailsBuilder(int index)
A list of messages that carry the error details.
|
Status.Builder |
addRepeatedField(Descriptors.FieldDescriptor field,
java.lang.Object value) |
Status |
build() |
Status |
buildPartial() |
Status.Builder |
clear() |
Status.Builder |
clearCode()
The status code, which should be an enum value of
[google.rpc.Code][google.rpc.Code].
|
Status.Builder |
clearDetails()
A list of messages that carry the error details.
|
Status.Builder |
clearField(Descriptors.FieldDescriptor field) |
Status.Builder |
clearMessage()
A developer-facing error message, which should be in English.
|
Status.Builder |
clearOneof(Descriptors.OneofDescriptor oneof) |
Status.Builder |
clone() |
int |
getCode()
The status code, which should be an enum value of
[google.rpc.Code][google.rpc.Code].
|
Status |
getDefaultInstanceForType() |
static Descriptors.Descriptor |
getDescriptor() |
Descriptors.Descriptor |
getDescriptorForType() |
Any |
getDetails(int index)
A list of messages that carry the error details.
|
Any.Builder |
getDetailsBuilder(int index)
A list of messages that carry the error details.
|
java.util.List<Any.Builder> |
getDetailsBuilderList()
A list of messages that carry the error details.
|
int |
getDetailsCount()
A list of messages that carry the error details.
|
java.util.List<Any> |
getDetailsList()
A list of messages that carry the error details.
|
AnyOrBuilder |
getDetailsOrBuilder(int index)
A list of messages that carry the error details.
|
java.util.List<? extends AnyOrBuilder> |
getDetailsOrBuilderList()
A list of messages that carry the error details.
|
java.lang.String |
getMessage()
A developer-facing error message, which should be in English.
|
ByteString |
getMessageBytes()
A developer-facing error message, which should be in English.
|
protected GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
Status.Builder |
mergeFrom(CodedInputStream input,
ExtensionRegistryLite extensionRegistry) |
Status.Builder |
mergeFrom(Message other) |
Status.Builder |
mergeFrom(Status other) |
Status.Builder |
mergeUnknownFields(UnknownFieldSet unknownFields) |
Status.Builder |
removeDetails(int index)
A list of messages that carry the error details.
|
Status.Builder |
setCode(int value)
The status code, which should be an enum value of
[google.rpc.Code][google.rpc.Code].
|
Status.Builder |
setDetails(int index,
Any.Builder builderForValue)
A list of messages that carry the error details.
|
Status.Builder |
setDetails(int index,
Any value)
A list of messages that carry the error details.
|
Status.Builder |
setField(Descriptors.FieldDescriptor field,
java.lang.Object value) |
Status.Builder |
setMessage(java.lang.String value)
A developer-facing error message, which should be in English.
|
Status.Builder |
setMessageBytes(ByteString value)
A developer-facing error message, which should be in English.
|
Status.Builder |
setRepeatedField(Descriptors.FieldDescriptor field,
int index,
java.lang.Object value) |
Status.Builder |
setUnknownFields(UnknownFieldSet unknownFields) |
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, newBuilderForField, onBuilt, onChanged, setUnknownFieldsProto3
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
addAll, addAll, mergeFrom, newUninitializedMessageException
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
mergeFrom
public static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable
in class GeneratedMessageV3.Builder<Status.Builder>
public Status.Builder clear()
clear
in interface Message.Builder
clear
in interface MessageLite.Builder
clear
in class GeneratedMessageV3.Builder<Status.Builder>
public Descriptors.Descriptor getDescriptorForType()
getDescriptorForType
in interface Message.Builder
getDescriptorForType
in interface MessageOrBuilder
getDescriptorForType
in class GeneratedMessageV3.Builder<Status.Builder>
public Status getDefaultInstanceForType()
getDefaultInstanceForType
in interface MessageLiteOrBuilder
getDefaultInstanceForType
in interface MessageOrBuilder
public Status build()
build
in interface Message.Builder
build
in interface MessageLite.Builder
public Status buildPartial()
buildPartial
in interface Message.Builder
buildPartial
in interface MessageLite.Builder
public Status.Builder clone()
clone
in interface Message.Builder
clone
in interface MessageLite.Builder
clone
in class GeneratedMessageV3.Builder<Status.Builder>
public Status.Builder setField(Descriptors.FieldDescriptor field, java.lang.Object value)
setField
in interface Message.Builder
setField
in class GeneratedMessageV3.Builder<Status.Builder>
public Status.Builder clearField(Descriptors.FieldDescriptor field)
clearField
in interface Message.Builder
clearField
in class GeneratedMessageV3.Builder<Status.Builder>
public Status.Builder clearOneof(Descriptors.OneofDescriptor oneof)
clearOneof
in interface Message.Builder
clearOneof
in class GeneratedMessageV3.Builder<Status.Builder>
public Status.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, java.lang.Object value)
setRepeatedField
in interface Message.Builder
setRepeatedField
in class GeneratedMessageV3.Builder<Status.Builder>
public Status.Builder addRepeatedField(Descriptors.FieldDescriptor field, java.lang.Object value)
addRepeatedField
in interface Message.Builder
addRepeatedField
in class GeneratedMessageV3.Builder<Status.Builder>
public Status.Builder mergeFrom(Message other)
mergeFrom
in interface Message.Builder
mergeFrom
in class AbstractMessage.Builder<Status.Builder>
public Status.Builder mergeFrom(Status other)
public final boolean isInitialized()
isInitialized
in interface MessageLiteOrBuilder
isInitialized
in class GeneratedMessageV3.Builder<Status.Builder>
public Status.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
mergeFrom
in interface Message.Builder
mergeFrom
in interface MessageLite.Builder
mergeFrom
in class AbstractMessage.Builder<Status.Builder>
java.io.IOException
public int getCode()
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
int32 code = 1;
getCode
in interface StatusOrBuilder
public Status.Builder setCode(int value)
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
int32 code = 1;
public Status.Builder clearCode()
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
int32 code = 1;
public java.lang.String getMessage()
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
string message = 2;
getMessage
in interface StatusOrBuilder
public ByteString getMessageBytes()
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
string message = 2;
getMessageBytes
in interface StatusOrBuilder
public Status.Builder setMessage(java.lang.String value)
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
string message = 2;
public Status.Builder clearMessage()
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
string message = 2;
public Status.Builder setMessageBytes(ByteString value)
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
string message = 2;
public java.util.List<Any> getDetailsList()
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
getDetailsList
in interface StatusOrBuilder
public int getDetailsCount()
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
getDetailsCount
in interface StatusOrBuilder
public Any getDetails(int index)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
getDetails
in interface StatusOrBuilder
public Status.Builder setDetails(int index, Any value)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Status.Builder setDetails(int index, Any.Builder builderForValue)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Status.Builder addDetails(Any value)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Status.Builder addDetails(int index, Any value)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Status.Builder addDetails(Any.Builder builderForValue)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Status.Builder addDetails(int index, Any.Builder builderForValue)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Status.Builder addAllDetails(java.lang.Iterable<? extends Any> values)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Status.Builder clearDetails()
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Status.Builder removeDetails(int index)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Any.Builder getDetailsBuilder(int index)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public AnyOrBuilder getDetailsOrBuilder(int index)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
getDetailsOrBuilder
in interface StatusOrBuilder
public java.util.List<? extends AnyOrBuilder> getDetailsOrBuilderList()
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
getDetailsOrBuilderList
in interface StatusOrBuilder
public Any.Builder addDetailsBuilder()
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public Any.Builder addDetailsBuilder(int index)
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public java.util.List<Any.Builder> getDetailsBuilderList()
A list of messages that carry the error details. There is a common set of message types for APIs to use.
repeated .google.protobuf.Any details = 3;
public final Status.Builder setUnknownFields(UnknownFieldSet unknownFields)
setUnknownFields
in interface Message.Builder
setUnknownFields
in class GeneratedMessageV3.Builder<Status.Builder>
public final Status.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
mergeUnknownFields
in interface Message.Builder
mergeUnknownFields
in class GeneratedMessageV3.Builder<Status.Builder>