Status
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ประเภท Status
กำหนดโมเดลข้อผิดพลาดเชิงตรรกะที่เหมาะกับสภาพแวดล้อมในการเขียนโปรแกรมแบบต่างๆ ซึ่งรวมถึง REST API และ RPC API gRPC จะใช้โปรโตคอลนี้ ข้อความ Status
แต่ละข้อความจะมีข้อมูล 3 อย่าง ได้แก่ รหัสข้อผิดพลาด ข้อความแสดงข้อผิดพลาด และรายละเอียดข้อผิดพลาด
คุณสามารถดูข้อมูลเพิ่มเติมเกี่ยวกับรูปแบบข้อผิดพลาดนี้และวิธีใช้โมเดลดังกล่าวได้ในคู่มือการออกแบบ API
การแสดง JSON |
{
"code": integer,
"message": string,
"details": [
{
"@type": string,
field1: ...,
...
}
]
} |
ช่อง |
code |
integer
รหัสสถานะ ซึ่งควรเป็นค่า enum ของ google.rpc.Code
|
message |
string
ข้อความแสดงข้อผิดพลาดที่นักพัฒนาแอปเห็น ซึ่งควรเป็นภาษาอังกฤษ ข้อความแสดงข้อผิดพลาดที่แสดงต่อผู้ใช้ควรแปลและส่งในช่อง google.rpc.Status.details หรือแปลโดยไคลเอ็นต์
|
details[] |
object
รายการข้อความที่มีรายละเอียดข้อผิดพลาด API จะใช้ชุดประเภทข้อความที่พบได้ทั่วไป ออบเจ็กต์ที่มีช่องประเภทที่กำหนดเอง ช่องเพิ่มเติม "@type" จะมี URI ที่ระบุประเภท ตัวอย่างเช่น { "id": 1234, "@type": "types.example.com/standard/id" }
|
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThe \u003ccode\u003eStatus\u003c/code\u003e type is a structured way to represent errors in various programming environments, including REST APIs and RPC APIs, and is used by gRPC.\u003c/p\u003e\n"],["\u003cp\u003eEach \u003ccode\u003eStatus\u003c/code\u003e message consists of three components: an integer error code (\u003ccode\u003ecode\u003c/code\u003e), a developer-facing error message in English (\u003ccode\u003emessage\u003c/code\u003e), and an optional list of objects (\u003ccode\u003edetails\u003c/code\u003e) containing further error specifics.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eStatus\u003c/code\u003e utilizes a common error model that is further detailed in the Google API Design Guide for developers seeking more information and practical implementation advice.\u003c/p\u003e\n"]]],["The `Status` type, used in APIs like gRPC, represents errors with three components: `code` (an integer from `google.rpc.Code`), `message` (a developer-facing English string), and `details` (a list of objects with error specifics). `details` contain objects with an `@type` field to specify the object type, and the `message` is intended for developer use, not directly for the end user. User-facing error information is localized and sent in `details`.\n"],null,["# Status\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n\nThe `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](https://github.com/grpc). Each `Status` message contains three 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 [API Design Guide](https://cloud.google.com/apis/design/errors).\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------|\n| ``` { \"code\": integer, \"message\": string, \"details\": [ { \"@type\": string, field1: ..., ... } ] } ``` |\n\n| Fields ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `code` | `integer` The status code, which should be an enum value of `google.rpc.Code`. |\n| `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](/photos/library/reference/rest/v1/Status#FIELDS.details) field, or localized by the client. |\n| `details[]` | `object` A list of messages that carry the error details. There is a common set of message types for APIs to use. An object containing fields of an arbitrary type. An additional field `\"@type\"` contains a URI identifying the type. Example: `{ \"id\": 1234, \"@type\": \"types.example.com/standard/id\" }`. |"]]