Status
הסוג Status
מגדיר מודל שגיאות לוגי שמתאים לסביבות תכנות שונות, כולל ממשקי API ל-REST וממשקי API ל-RPC. הוא נמצא בשימוש של gRPC. כל הודעת Status
מכילה שלושה נתונים: קוד שגיאה, הודעת שגיאה ופרטי שגיאה.
במדריך לעיצוב API אפשר לקרוא מידע נוסף על מודל השגיאות הזה ולהבין איך לעבוד איתו.
ייצוג JSON |
{
"code": integer,
"message": string,
"details": [
{
"@type": string,
field1: ...,
...
}
]
} |
שדות |
code |
integer
קוד הסטטוס, שצריך להיות ערך enum של 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 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-09-10 (שעון UTC).
[null,null,["עדכון אחרון: 2024-09-10 (שעון UTC)."],[[["The `Status` type is a standard error model used by gRPC and REST APIs to represent errors with a code, message, and optional details."],["Each `Status` object includes an integer `code` from `google.rpc.Code`, a developer-facing `message`, and an array of `details` for further information."],["The `details` field allows for structured error data using custom types identified by a `@type` URI."]]],["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, and `details` is a list of objects providing further error information, each specifying its type via `\"@type\"`. The JSON representation uses these fields to structure error messages. User-facing messages should be localized.\n"]]