Package google.rpc
狀態
Status
類型會定義適用於不同程式設計環境 (包含 REST API 和遠端程序呼叫 (RPC) API) 的邏輯錯誤模型。gRPC 會使用這個模型。每個 Status
訊息包含三部分的資料:錯誤代碼、錯誤訊息和錯誤詳細資料。
如要進一步瞭解這個錯誤模型,以及如何使用這個錯誤模型,請參閱 API 設計指南。
欄位 |
code |
int32
狀態碼,應為 google.rpc.Code 的列舉值。
|
message |
string
向開發人員顯示的錯誤訊息,應以英文呈現。所有向使用者顯示的錯誤訊息都應經過本地化,並透過 google.rpc.Status.details 欄位傳送,或是由用戶端加以本地化。
|
details[] |
Any
附有錯誤詳細資料的訊息清單。這是供 API 使用的一組常用訊息類型。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-10 (世界標準時間)。
[null,null,["上次更新時間:2025-02-10 (世界標準時間)。"],[[["The `Status` type defines a logical error model suitable for REST APIs and RPC APIs, and is used by gRPC."],["Each `Status` message contains an error code, message, and details, providing comprehensive error information."],["Developers can access further information about the error model and its usage in the API Design Guide."]]],["The `Status` message, used in REST and RPC APIs like gRPC, defines a logical error model. It comprises three data points: `code` (an integer representing the error), `message` (a developer-facing English error description), and `details` (a list of messages carrying specific error information). The `details` can contain user-facing localized error messages. The status code is a `google.rpc.Code` enum value.\n"]]