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.

Implements

Constructors

constructor

new Status(properties?): Status

Constructs a new Status.

Parameters

NameTypeDescription
properties?IStatusProperties to set

Returns

Status

Properties

code

code: number

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

Implementation of

IStatus.code


details

details: IAny[]

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

Implementation of

IStatus.details


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.

Implementation of

IStatus.message

Methods

toJSON

toJSON(): Object

Converts this Status to JSON.

Returns

Object

JSON object


create

create(properties?): Status

Creates a new Status instance using the specified properties.

Parameters

NameTypeDescription
properties?IStatusProperties to set

Returns

Status

Status instance


decode

decode(reader, length?): Status

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

Status

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): Status

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

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

Status

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
messageIStatusStatus 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
messageIStatusStatus 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


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for Status

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


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