Mode debug prints for error code 400

This commit is contained in:
QuantumEntangledAndy committed 2024-04-28 11:38:39 +07:00
1 parent 366c2a4b69
commit e6321f36d7
19 files changed
+106 -32

No files matched your search

+5 -3
View File
@@ -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
View File
@@ -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
},