טיפול בשגיאות
יש להשתמש בקוד הסטטוס 400 Bad Request
לכל השגיאות שמוגדרות במפרט הזה. בכל שאר השגיאות, היצרנים צריכים להשתמש בשגיאות בטווח 4XX לשגיאות לקוח, ובטווח 5XX לשגיאות שרת. התגובה תמיד צריכה לכלול גוף JSON בפורמט הבא עבור כל מקרי השגיאה:
{
"name": "camera.info",
"state": "error",
"error": {
"code": "serverError",
"message": "cannot get camera info."
}
}
name
יכול להיות כל אחד מהערכים camera.info
, camera.state
, camera.checkForUpdates
,
camera.commands.status
ו-camera.commandName
.
- עבור קוד סטטוס 400, הערך
code
צריך להיות אחד מהבאים:unknownCommand
,
cameraInExclusiveUse
, missingParameter
, invalidParameterName
או
invalidParameterValue
.
message
מוגדר על ידי היצרנים ולא צפוי להיות מותאם לשוק המקומי
הודעה.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-08-21 (שעון UTC).
[null,null,["עדכון אחרון: 2024-08-21 (שעון UTC)."],[[["Always use the `400 Bad Request` status code for errors defined in the specification and appropriate 4XX or 5XX codes for other client or server errors, respectively."],["All error responses must include a JSON body with `name`, `state`, and an `error` object containing `code` and `message`."],["The `error.code` field uses predefined values for 400 errors (`unknownCommand`, `cameraInExclusiveUse`, `missingParameter`, `invalidParameterName`, `invalidParameterValue`) while manufacturers define the `error.message`."],["The `name` field identifies the specific request, such as `camera.info` or `camera.commands.status`, associated with the error."]]],["Error responses must include a JSON body with \"name,\" \"state,\" and \"error\" fields. For specified errors, use the `400 Bad Request` status code, otherwise, employ 4XX for client and 5XX for server errors. The \"name\" field can be one of several camera-related identifiers. \"Code\" within the error object must be one of five predefined error codes for 400 responses. The \"message\" field is free-form, manufacturer-defined, and non-localized.\n"]]