Status
يحدّد النوع Status
نموذج خطأ منطقي مناسبًا لبيئات البرمجة المختلفة، بما في ذلك واجهات برمجة تطبيقات REST وواجهات برمجة تطبيقات RPC. وتُستخدَم من قِبل gRPC. تحتوي كل رسالة Status
على ثلاث بيانات: رمز الخطأ ورسالة الخطأ وتفاصيل الخطأ.
يمكنك معرفة المزيد من المعلومات عن نموذج الخطأ هذا وكيفية التعامل معه في دليل تصميم واجهة برمجة التطبيقات.
تمثيل JSON |
{
"code": integer,
"message": string,
"details": [
{
"@type": string,
field1: ...,
...
}
]
} |
الحقول |
code |
integer
رمز الحالة، الذي يجب أن يكون قيمة تعداد بقيمة google.rpc.Code .
|
message |
string
رسالة خطأ مواجهة للمطوِّر، ويجب أن تكون باللغة الإنجليزية يجب ترجمة أي رسالة خطأ تظهر للمستخدم وإرسالها في الحقل google.rpc.Status.details ، أو ترجمتها من خلال البرنامج.
|
details[] |
object
قائمة بالرسائل التي تتضمّن تفاصيل الخطأ. وهناك مجموعة شائعة من أنواع الرسائل التي يمكن لواجهات برمجة التطبيقات استخدامها. كائن يحتوي على حقول من نوع عشوائي يحتوي الحقل الإضافي "@type" على معرف موارد منتظم (URI) يحدّد النوع. مثال: { "id": 1234, "@type": "types.example.com/standard/id" }
|
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2024-09-05 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2024-09-05 (حسب التوقيت العالمي المتفَّق عليه)"],[[["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"]]