Hata işleme
Bu spesifikasyonda tanımlanan tüm hatalar için 400 Bad Request
durum kodunu kullanın. Üreticiler, diğer tüm hatalar için istemci hataları için 4XX aralığındaki ve sunucu hataları için 5XX aralığındaki hataları kullanmalıdır. Yanıt, tüm hata durumları için her zaman aşağıdaki biçimde bir JSON gövdesi içermelidir:
{
"name": "camera.info",
"state": "error",
"error": {
"code": "serverError",
"message": "cannot get camera info."
}
}
name
şunlardan herhangi biri olabilir: camera.info
, camera.state
, camera.checkForUpdates
,
camera.commands.status
ve camera.commandName
.
code
, 400 durum kodu için aşağıdakilerden biri olmalıdır:unknownCommand
,
cameraInExclusiveUse
, missingParameter
, invalidParameterName
veya
invalidParameterValue
.
message
, üreticiler tarafından tanımlanmıştır ve yerelleştirilmiş olması beklenmez.
mesajını alırsınız.
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2024-08-21 UTC.
[null,null,["Son güncelleme tarihi: 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"]]