Reference documentation and code samples for the Google API Common Protos Client class Status.
TheStatustype defines a logical error model that is suitable for
different programming environments, including REST APIs and RPC APIs. It is
used bygRPC. EachStatusmessage 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 theAPI Design Guide.
Generated from protobuf messagegoogle.rpc.Status
Namespace
Google \ Rpc
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ code
int
The status code, which should be an enum value ofgoogle.rpc.Code.
↳ message
string
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in thegoogle.rpc.Status.detailsfield, or localized by the client.
A list of messages that carry the error details. There is a common set of message types for APIs to use.
getCode
The status code, which should be an enum value ofgoogle.rpc.Code.
Returns
Type
Description
int
setCode
The status code, which should be an enum value ofgoogle.rpc.Code.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getMessage
A developer-facing error message, which should be in English. Any
user-facing error message should be localized and sent in thegoogle.rpc.Status.detailsfield, or localized
by the client.
Returns
Type
Description
string
setMessage
A developer-facing error message, which should be in English. Any
user-facing error message should be localized and sent in thegoogle.rpc.Status.detailsfield, or localized
by the client.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDetails
A list of messages that carry the error details. There is a common set of
message types for APIs to use.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google API Common Protos Client - Class Status (4.12.3)\n\nVersion latestkeyboard_arrow_down\n\n- [4.12.3 (latest)](/php/docs/reference/common-protos/latest/Rpc.Status)\n- [4.12.2](/php/docs/reference/common-protos/4.12.2/Rpc.Status)\n- [4.11.0](/php/docs/reference/common-protos/4.11.0/Rpc.Status)\n- [4.10.0](/php/docs/reference/common-protos/4.10.0/Rpc.Status)\n- [4.9.0](/php/docs/reference/common-protos/4.9.0/Rpc.Status)\n- [4.8.3](/php/docs/reference/common-protos/4.8.3/Rpc.Status) \nReference documentation and code samples for the Google API Common Protos Client class Status.\n\nThe `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors).\n\nGenerated from protobuf message `google.rpc.Status`\n\nNamespace\n---------\n\nGoogle \\\\ Rpc\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getCode\n\nThe status code, which should be an enum value of\n[google.rpc.Code](/php/docs/reference/common-protos/latest/Rpc.Code).\n\n### setCode\n\nThe status code, which should be an enum value of\n[google.rpc.Code](/php/docs/reference/common-protos/latest/Rpc.Code).\n\n### getMessage\n\nA developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details](/php/docs/reference/common-protos/latest/Rpc.Status#_Google_Rpc_Status__getDetails__) field, or localized\nby the client.\n\n### setMessage\n\nA developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details](/php/docs/reference/common-protos/latest/Rpc.Status#_Google_Rpc_Status__getDetails__) field, or localized\nby the client.\n\n### getDetails\n\nA list of messages that carry the error details. There is a common set of\nmessage types for APIs to use.\n\n### setDetails\n\nA list of messages that carry the error details. There is a common set of\nmessage types for APIs to use."]]