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-08-21 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2024-08-21 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe \u003ccode\u003eStatus\u003c/code\u003e type is a structured approach to representing errors in systems like REST APIs and RPC APIs, encompassing an error code, message, and details for comprehensive error handling.\u003c/p\u003e\n"],["\u003cp\u003eIt's built upon a standard JSON structure with designated fields for 'code', 'message', and 'details', ensuring consistent error reporting across different platforms and programming environments.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can leverage the accompanying API Design Guide to delve deeper into using the \u003ccode\u003eStatus\u003c/code\u003e type effectively and gain practical insights for its implementation.\u003c/p\u003e\n"]]],["The `Status` type models errors with three components: `code` (an integer representing the error), `message` (a developer-facing English error description), and `details` (a list of objects providing further error context). `details` contains an array of objects, each with a type identifier. This model is used by gRPC and suitable for REST and RPC APIs. User-facing error messages are recommended to be localized and sent in the details or on the client.\n"],null,["# Status\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\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| JSON representation |\n|------------------------------------------------------------------------------------------------------|\n| ``` { \"code\": integer, \"message\": string, \"details\": [ { \"@type\": string, field1: ..., ... } ] } ``` |\n\n| Fields ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `code` | `integer` 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](/people/api/rest/v1/Status#FIELDS.details) field, or localized by the client. |\n| `details[]` | `object` A list of messages that carry the error details. There is a common set of message types for APIs to use. An object containing fields of an arbitrary type. An additional field `\"@type\"` contains a URI identifying the type. Example: `{ \"id\": 1234, \"@type\": \"types.example.com/standard/id\" }`. |"]]