diff --git a/src/common.rs b/src/common.rs index 69316388..54b6885a 100644 --- a/src/common.rs +++ b/src/common.rs @@ -162,12 +162,12 @@ pub async fn run_command( .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) .spawn() - .with_context(|| format!("error spawning {} call", name))? + .with_context(|| format!("error spawning {name} call ({path})", path = path.display()))? .wait() .await - .with_context(|| format!("error during {} call", name))?; + .with_context(|| format!("error during {name} call"))?; if !status.success() { - bail!("{} call returned a bad status", name); + bail!("{name} call returned a bad status"); } Ok(()) } diff --git a/src/pipelines/sass.rs b/src/pipelines/sass.rs index 8e613613..b35f7a79 100644 --- a/src/pipelines/sass.rs +++ b/src/pipelines/sass.rs @@ -84,7 +84,9 @@ impl Sass { tracing::info!(path = ?rel_path, "compiling sass/scss"); common::run_command(Application::Sass.name(), &sass, args).await?; - let css = fs::read_to_string(&file_path).await?; + let css = fs::read_to_string(&file_path) + .await + .with_context(|| format!("error reading CSS result file '{file_path}'"))?; fs::remove_file(&file_path).await?; // Check if the specified SASS/SCSS file should be inlined. @@ -103,9 +105,12 @@ impl Sass { let file_path = self.cfg.staging_dist.join(&file_name); // Write the generated CSS to the filesystem. - fs::write(&file_path, css) - .await - .context("error writing SASS pipeline output")?; + fs::write(&file_path, css).await.with_context(|| { + format!( + "error writing SASS pipeline output file '{}'", + file_path.display() + ) + })?; // Generate a hashed reference to the new CSS file. CssRef::File(file_name)