Skip to main content

Class: Status

google.rpc.Status

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.

Properties

code

code: number

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


details

details: $Properties[]

A list of messages that carry the error details. There is a common set of message types for APIs to use.


message

message: string

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.

Methods

toJSON

toJSON(): Object

Converts this Status to JSON.

Returns

Object

JSON object


create

create(properties?): Status & $Properties

Creates a new Status instance using the specified properties.

Parameters

NameTypeDescription
properties?$PropertiesProperties to set

Returns

Status & $Properties

Status instance

create(properties?): Status

Parameters

NameType
properties?$Properties

Returns

Status


decode

decode(reader, length?): Status & $Properties

Decodes a Status message from the specified reader or buffer.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?numberMessage length if known beforehand

Returns

Status & $Properties

Status

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): Status & $Properties

Decodes a Status message from the specified reader or buffer, length delimited.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

Status & $Properties

Status

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode

encode(message, writer?): Writer

Encodes the specified Status message. Does not implicitly google.rpc.Status.verify|verify messages.

Parameters

NameTypeDescription
message$PropertiesStatus message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

Encodes the specified Status message, length delimited. Does not implicitly google.rpc.Status.verify|verify messages.

Parameters

NameTypeDescription
message$PropertiesStatus message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


fromObject

fromObject(object): Status

Creates a Status message from a plain object. Also converts values to their respective internal types.

Parameters

NameTypeDescription
objectObjectPlain object

Returns

Status

Status


toObject

toObject(message, options?): Object

Creates a plain object from a Status message. Also converts values to other types if specified.

Parameters

NameTypeDescription
messageStatusStatus
options?IConversionOptionsConversion options

Returns

Object

Plain object