文档API 参考

Rust · 0.1.0

Status

REST 错误体:数字型 gRPC 代码、说明与可选类型化详情。

检查传输与状态

同时读取 HTTP 状态与此对象。details 条目可携带 @type 和重试信息。Connect 的错误体采用不同表示。不是每个错误都可重试,存储清理开始后发生写入错误也不保证回滚。重试说明见 API 通用调用约定。

此结构在哪里使用

以下链接根据协议快照中的直接引用生成。认证、可写字段和运行行为应以调用操作为准;可复用资源结构本身并不是完整的写入请求。

结构与字段

object

The `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. You 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).

字段类型 / 是否必需描述
codeinteger (int32)The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
messagestringA 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][google.rpc.Status.details] field, or localized by the client.
detailsarray<GoogleProtobufAny>A list of messages that carry the error details. There is a common set of message types for APIs to use.

完整结构

约束与嵌套结构请以这份完整 JSON 定义为准。字段出现在这里,并不意味着每位调用者都能修改它。

{
  "type": "object",
  "properties": {
    "code": {
      "type": "integer",
      "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].",
      "format": "int32"
    },
    "message": {
      "type": "string",
      "description": "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][google.rpc.Status.details] field, or localized by the client."
    },
    "details": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/GoogleProtobufAny"
      },
      "description": "A list of messages that carry the error details.  There is a common set of message types for APIs to use."
    }
  },
  "description": "The `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. You 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)."
}