Package com.google.rpc
Class ErrorInfo.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder<MessageType,BuilderType>
com.google.protobuf.GeneratedMessageLite.Builder<ErrorInfo,ErrorInfo.Builder>
com.google.rpc.ErrorInfo.Builder
- All Implemented Interfaces:
com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,ErrorInfoOrBuilder,Cloneable
- Enclosing class:
- ErrorInfo
public static final class ErrorInfo.Builder
extends com.google.protobuf.GeneratedMessageLite.Builder<ErrorInfo,ErrorInfo.Builder>
implements ErrorInfoOrBuilder
Describes the cause of the error with structured details.
Example of an error when contacting the "pubsub.googleapis.com" API when it
is not enabled:
{ "reason": "API_DISABLED"
"domain": "googleapis.com"
"metadata": {
"resource": "projects/123",
"service": "pubsub.googleapis.com"
}
}
This response indicates that the pubsub.googleapis.com API is not enabled.
Example of an error that is returned when attempting to create a Spanner
instance in a region that is out of stock:
{ "reason": "STOCKOUT"
"domain": "spanner.googleapis.com",
"metadata": {
"availableRegions": "us-central1,us-east2"
}
}
Protobuf type google.rpc.ErrorInfo-
Field Summary
Fields inherited from class com.google.protobuf.GeneratedMessageLite.Builder
instance -
Method Summary
Modifier and TypeMethodDescriptionThe logical grouping to which the "reason" belongs.The reason of the error.booleancontainsMetadata(String key) Additional structured details about this error.The logical grouping to which the "reason" belongs.com.google.protobuf.ByteStringThe logical grouping to which the "reason" belongs.Deprecated.intAdditional structured details about this error.Additional structured details about this error.getMetadataOrDefault(String key, String defaultValue) Additional structured details about this error.getMetadataOrThrow(String key) Additional structured details about this error.The reason of the error.com.google.protobuf.ByteStringThe reason of the error.putAllMetadata(Map<String, String> values) Additional structured details about this error.putMetadata(String key, String value) Additional structured details about this error.removeMetadata(String key) Additional structured details about this error.The logical grouping to which the "reason" belongs.setDomainBytes(com.google.protobuf.ByteString value) The logical grouping to which the "reason" belongs.The reason of the error.setReasonBytes(com.google.protobuf.ByteString value) The reason of the error.Methods inherited from class com.google.protobuf.GeneratedMessageLite.Builder
build, buildPartial, clear, clone, copyOnWrite, copyOnWriteInternal, getDefaultInstanceForType, internalMergeFrom, isInitialized, mergeFrom, mergeFrom, mergeFrom, mergeFromMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType, isInitialized
-
Method Details
-
getReason
The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.
string reason = 1 [json_name = "reason"];- Specified by:
getReasonin interfaceErrorInfoOrBuilder- Returns:
- The reason.
-
getReasonBytes
public com.google.protobuf.ByteString getReasonBytes()The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.
string reason = 1 [json_name = "reason"];- Specified by:
getReasonBytesin interfaceErrorInfoOrBuilder- Returns:
- The bytes for reason.
-
setReason
The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.
string reason = 1 [json_name = "reason"];- Parameters:
value- The reason to set.- Returns:
- This builder for chaining.
-
clearReason
The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.
string reason = 1 [json_name = "reason"];- Returns:
- This builder for chaining.
-
setReasonBytes
The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.
string reason = 1 [json_name = "reason"];- Parameters:
value- The bytes for reason to set.- Returns:
- This builder for chaining.
-
getDomain
The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com".
string domain = 2 [json_name = "domain"];- Specified by:
getDomainin interfaceErrorInfoOrBuilder- Returns:
- The domain.
-
getDomainBytes
public com.google.protobuf.ByteString getDomainBytes()The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com".
string domain = 2 [json_name = "domain"];- Specified by:
getDomainBytesin interfaceErrorInfoOrBuilder- Returns:
- The bytes for domain.
-
setDomain
The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com".
string domain = 2 [json_name = "domain"];- Parameters:
value- The domain to set.- Returns:
- This builder for chaining.
-
clearDomain
The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com".
string domain = 2 [json_name = "domain"];- Returns:
- This builder for chaining.
-
setDomainBytes
The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com".
string domain = 2 [json_name = "domain"];- Parameters:
value- The bytes for domain to set.- Returns:
- This builder for chaining.
-
getMetadataCount
public int getMetadataCount()Description copied from interface:ErrorInfoOrBuilderAdditional structured details about this error. Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.map<string, string> metadata = 3 [json_name = "metadata"];- Specified by:
getMetadataCountin interfaceErrorInfoOrBuilder
-
containsMetadata
Additional structured details about this error. Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.map<string, string> metadata = 3 [json_name = "metadata"];- Specified by:
containsMetadatain interfaceErrorInfoOrBuilder
-
clearMetadata
-
removeMetadata
Additional structured details about this error. Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.map<string, string> metadata = 3 [json_name = "metadata"]; -
getMetadata
Deprecated.UsegetMetadataMap()instead.- Specified by:
getMetadatain interfaceErrorInfoOrBuilder
-
getMetadataMap
Additional structured details about this error. Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.map<string, string> metadata = 3 [json_name = "metadata"];- Specified by:
getMetadataMapin interfaceErrorInfoOrBuilder
-
getMetadataOrDefault
Additional structured details about this error. Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.map<string, string> metadata = 3 [json_name = "metadata"];- Specified by:
getMetadataOrDefaultin interfaceErrorInfoOrBuilder
-
getMetadataOrThrow
Additional structured details about this error. Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.map<string, string> metadata = 3 [json_name = "metadata"];- Specified by:
getMetadataOrThrowin interfaceErrorInfoOrBuilder
-
putMetadata
Additional structured details about this error. Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.map<string, string> metadata = 3 [json_name = "metadata"]; -
putAllMetadata
Additional structured details about this error. Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.map<string, string> metadata = 3 [json_name = "metadata"];
-