Loại Status xác định một mô hình lỗi logic phù hợp với nhiều môi trường lập trình, bao gồm cả API REST và API RPC. gRPC sử dụng lớp này. Mỗi thông báo Status chứa 3 phần dữ liệu: mã lỗi, thông báo lỗi và thông tin chi tiết về lỗi.
Bạn có thể tìm hiểu thêm về mô hình lỗi này và cách xử lý mô hình lỗi này trong Hướng dẫn thiết kế API.
Trường
code
int32
Mã trạng thái, phải là giá trị enum của google.rpc.Code.
message
string
Thông báo lỗi dành cho nhà phát triển, phải bằng tiếng Anh. Mọi thông báo lỗi hiển thị với người dùng đều phải được bản địa hoá và gửi trong trường google.rpc.Status.details hoặc do ứng dụng bản địa hoá.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-02-10 UTC."],[[["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"]]