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 และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-09-05 UTC
[null,null,["อัปเดตล่าสุด 2024-09-05 UTC"],[[["The `Status` type is a structured approach to define errors in APIs that's suitable for various programming environments, including REST and RPC."],["Each `Status` message includes an error code, a message intended for developers, and optional details that can hold localized or additional information."],["These error details are provided as a list of objects with a designated type specified using the `@type` field for clarity and structured data representation."]]],["The `Status` type represents a logical error model with three data components: `code`, `message`, and `details`. `code` is an integer status code. `message` is a developer-facing English error message, while user-facing messages should be localized and sent in `details`. `details` is a list of objects carrying specific error information, with each object including a \"@type\" field for type identification. This model is used in REST and RPC APIs, and is also used by gRPC.\n"]]