การจัดการข้อผิดพลาด
ใช้รหัสสถานะ 400 Bad Request
สำหรับข้อผิดพลาดทั้งหมดที่ระบุไว้ในข้อกำหนดเฉพาะนี้ สำหรับข้อผิดพลาดอื่นๆ ทั้งหมด ผู้ผลิตควรใช้ข้อผิดพลาดในช่วง 4XX สำหรับข้อผิดพลาดไคลเอ็นต์ และช่วง 5XX สำหรับข้อผิดพลาดเซิร์ฟเวอร์ การตอบกลับควรมีเนื้อหา JSON ในรูปแบบต่อไปนี้เสมอสำหรับกรณีข้อผิดพลาด all
{
"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
code
ควรเป็นค่าใดค่าหนึ่งต่อไปนี้สำหรับรหัสสถานะ 400:unknownCommand
cameraInExclusiveUse
, missingParameter
, invalidParameterName
หรือ
invalidParameterValue
message
กำหนดโดยผู้ผลิต และคาดว่าไม่ใช่การแปล
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 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"]]