Class Status

public final class Status extends GeneratedMessageV3 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. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide.

Protobuf type google.rpc.Status

Implements

StatusOrBuilder

Static Fields

CODE_FIELD_NUMBER

public static final int CODE_FIELD_NUMBER
Field Value
TypeDescription
int

DETAILS_FIELD_NUMBER

public static final int DETAILS_FIELD_NUMBER
Field Value
TypeDescription
int

MESSAGE_FIELD_NUMBER

public static final int MESSAGE_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static Status getDefaultInstance()
Returns
TypeDescription
Status

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

newBuilder()

public static Status.Builder newBuilder()
Returns
TypeDescription
Status.Builder

newBuilder(Status prototype)

public static Status.Builder newBuilder(Status prototype)
Parameter
NameDescription
prototypeStatus
Returns
TypeDescription
Status.Builder

parseDelimitedFrom(InputStream input)

public static Status parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Status
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Status parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Status
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static Status parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
Status
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Status parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Status
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Status parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
Status
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Status parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Status
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Status parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
Status
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Status parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Status
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static Status parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Status
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Status parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Status
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static Status parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
Status
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Status parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Status
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<Status> parser()
Returns
TypeDescription
Parser<Status>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getCode()

public int getCode()

The status code, which should be an enum value of google.rpc.Code.

int32 code = 1;

Returns
TypeDescription
int

The code.

getDefaultInstanceForType()

public Status getDefaultInstanceForType()
Returns
TypeDescription
Status

getDetails(int index)

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;

Parameter
NameDescription
indexint
Returns
TypeDescription
Any

getDetailsCount()

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;

Returns
TypeDescription
int

getDetailsList()

public 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;

Returns
TypeDescription
List<Any>

getDetailsOrBuilder(int index)

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;

Parameter
NameDescription
indexint
Returns
TypeDescription
AnyOrBuilder

getDetailsOrBuilderList()

public 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;

Returns
TypeDescription
List<? extends com.google.protobuf.AnyOrBuilder>

getMessage()

public 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 field, or localized by the client.

string message = 2;

Returns
TypeDescription
String

The message.

getMessageBytes()

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 field, or localized by the client.

string message = 2;

Returns
TypeDescription
ByteString

The bytes for message.

getParserForType()

public Parser<Status> getParserForType()
Returns
TypeDescription
Parser<Status>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

getUnknownFields()

public final UnknownFieldSet getUnknownFields()
Returns
TypeDescription
UnknownFieldSet
Overrides

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

public Status.Builder newBuilderForType()
Returns
TypeDescription
Status.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Status.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
Status.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

public Status.Builder toBuilder()
Returns
TypeDescription
Status.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides Exceptions
TypeDescription
IOException