Status
نوع Status
یک مدل خطای منطقی را تعریف می کند که برای محیط های برنامه نویسی مختلف، از جمله REST API و RPC API مناسب است. توسط gRPC استفاده می شود. هر پیام Status
شامل سه داده است: کد خطا، پیام خطا و جزئیات خطا.
در راهنمای طراحی API میتوانید درباره این مدل خطا و نحوه کار با آن اطلاعات بیشتری کسب کنید.
نمایندگی JSON |
---|
{
"code": integer,
"message": string,
"details": [
{
"@type": string,
field1: ...,
...
}
]
} |
فیلدها |
---|
code | integer کد وضعیت، که باید مقداری از google.rpc.Code باشد. |
message | string یک پیغام خطای برنامهنویس، که باید به زبان انگلیسی باشد. هر پیام خطای کاربر باید بومی سازی شده و در قسمت google.rpc.Status.details ارسال شود یا توسط مشتری بومی سازی شود. |
details[] | object لیستی از پیام هایی که حاوی جزئیات خطا هستند. مجموعه ای متداول از انواع پیام ها برای استفاده API ها وجود دارد. یک شی حاوی فیلدهایی از نوع دلخواه. یک فیلد اضافی "@type" حاوی یک URI است که نوع را مشخص می کند. مثال: { "id": 1234, "@type": "types.example.com/standard/id" } . |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-01-10 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-01-10 بهوقت ساعت هماهنگ جهانی."],[[["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"]]