diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58403644..931d256a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,6 +38,7 @@ jobs: with: chrome-version: 'latest' install-chromedriver: true + id: setup-chrome - uses: dtolnay/rust-toolchain@stable with: components: clippy diff --git a/plotly_static/build.rs b/plotly_static/build.rs index f8b2c076..49f18a50 100644 --- a/plotly_static/build.rs +++ b/plotly_static/build.rs @@ -174,19 +174,19 @@ fn setup_driver(config: &WebdriverDownloadConfig) -> Result<()> { match config.driver_name { CHROMEDRIVER_NAME => { let driver_info = ChromedriverInfo::new(webdriver_bin.clone(), browser_path); - runtime - .block_on(async { download_with_retry(&driver_info, false, true, 1).await }) - .with_context(|| { - format!("Failed to download and install {}", config.driver_name) - })?; + let dl_res = + runtime.block_on(async { download_with_retry(&driver_info, false, true, 1).await }); + if let Err(e) = dl_res { + return Err(anyhow!("Failed to download and install chromedriver").context(e)); + } } GECKODRIVER_NAME => { let driver_info = GeckodriverInfo::new(webdriver_bin.clone(), browser_path); - runtime - .block_on(async { download_with_retry(&driver_info, false, true, 1).await }) - .with_context(|| { - format!("Failed to download and install {}", config.driver_name) - })?; + let dl_res = + runtime.block_on(async { download_with_retry(&driver_info, false, true, 1).await }); + if let Err(e) = dl_res { + return Err(anyhow!("Failed to download and install geckodriver").context(e)); + } } _ => return Err(anyhow!("Unsupported driver type: {}", config.driver_name)), }