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 使用。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eThe \u003ccode\u003eStatus\u003c/code\u003e type defines a logical error model suitable for various programming environments, including REST and RPC APIs.\u003c/p\u003e\n"],["\u003cp\u003eEach \u003ccode\u003eStatus\u003c/code\u003e message includes three data components: an error code, an error message, and error details.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ecode\u003c/code\u003e field in \u003ccode\u003eStatus\u003c/code\u003e is an integer representing the error code as defined in \u003ccode\u003egoogle.rpc.Code\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emessage\u003c/code\u003e field is a developer-facing English error message, while user-facing messages should be localized.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003edetails\u003c/code\u003e field contains a list of messages that provide additional information about the error.\u003c/p\u003e\n"]]],[],null,["# Package google.rpc\n\nIndex\n-----\n\n- [Status](/maps/tt/route-optimization/experimental/load-cost/reference/rpc/google.rpc#google.rpc.Status) (message)\n\nStatus\n------\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| Fields ||\n|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `code` | `int32` 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](/maps/tt/route-optimization/experimental/load-cost/reference/rpc/google.rpc#google.rpc.Status.FIELDS.repeated.google.protobuf.Any.google.rpc.Status.details) field, or localized by the client. |\n| `details[]` | [Any](https://protobuf.dev/reference/protobuf/google.protobuf/#any) A list of messages that carry the error details. There is a common set of message types for APIs to use. |"]]