From 4ab788d689385e5758b40c69a296ac7a36966264 Mon Sep 17 00:00:00 2001 From: Subhradeep Chakraborty Date: Fri, 29 Aug 2025 14:52:50 +0530 Subject: [PATCH] fix: return error if all the dashboard data could not be loaded --- src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index e4e56d1..a01e747 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -399,7 +399,21 @@ pub async fn generate_report( log::error!( "[REPORT] error finding the span element for dashboard {dashboard_id}: {e}" ); - log::info!("[REPORT] proceeding with whatever data is loaded until now"); + let page_url = page.url().await; + take_screenshot(&page, org_id, dashboard_id, true).await?; + // Take a screenshot before killing the browser to help debug login issues + log::info!("killing browser"); + browser.close().await?; + browser.wait().await?; + handle.await?; + browser.kill().await; + if let Err(e) = user_tmp_dir.close() { + log::error!("Error closing temporary directory for dashboard {dashboard_id}: {e}"); + } + return Err(anyhow::anyhow!( + "[REPORT] error finding the span element for dashboard {dashboard_id}: {e}: current url: {:#?}. Some panels could not be loaded within the timeout.", + page_url + )); } Ok(dur) => { log::info!(