Mode debug prints for error code 400
This commit is contained in:
19 files changed
+106
-32
No files matched your search
@@ -120,15 +120,17 @@ impl NeoInstance {
|
||||
if let Some(cam) = camera.clone() {
|
||||
let cam_ref = cam.as_ref();
|
||||
let mut r = Err(anyhow!("No run"));
|
||||
for _ in 0..5 {
|
||||
for i in 0..5 {
|
||||
r = task(cam_ref).await;
|
||||
if let Err(e) = &r {
|
||||
log::trace!("- Task Result: {e:?}");
|
||||
log::debug!("- Task Error: {e:?}");
|
||||
}
|
||||
if let Err(Some(neolink_core::Error::CameraServiceUnavailable(400))) = r.as_ref().map_err(|e| e.downcast_ref::<neolink_core::Error>()) {
|
||||
if let Err(Some(e @ neolink_core::Error::CameraServiceUnavailable{code: 400, ..})) = r.as_ref().map_err(|e| e.downcast_ref::<neolink_core::Error>()) {
|
||||
// Retryable without a reconnect
|
||||
// Usually occurs when camera is starting up
|
||||
// or the connection is initialising
|
||||
log::debug!("Got a 400 code for {e:?} retry {i}/5, ");
|
||||
|
||||
sleep(Duration::from_secs(1)).await;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -458,7 +458,7 @@ async fn listen_on_camera(camera: NeoInstance, mqtt_instance: MqttInstance) -> R
|
||||
}).await;
|
||||
let image = match image {
|
||||
Err(e) => match e.downcast::<neolink_core::Error>() {
|
||||
Ok(neolink_core::Error::CameraServiceUnavailable(_)) => {
|
||||
Ok(neolink_core::Error::CameraServiceUnavailable{..}) => {
|
||||
log::debug!("Image not supported");
|
||||
futures::future::pending().await
|
||||
},
|
||||
@@ -502,7 +502,7 @@ async fn listen_on_camera(camera: NeoInstance, mqtt_instance: MqttInstance) -> R
|
||||
}).await;
|
||||
let xml = match xml {
|
||||
Err(e) => match e.downcast::<neolink_core::Error>() {
|
||||
Ok(neolink_core::Error::CameraServiceUnavailable(_)) => {
|
||||
Ok(neolink_core::Error::CameraServiceUnavailable{..}) => {
|
||||
log::debug!("Battery not supported");
|
||||
futures::future::pending().await
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user