Skip to content

Commit

Permalink
Merge pull request #2674 from itowlson/tell-us-the-fucking-file
Browse files Browse the repository at this point in the history
Tell user which file we failed to read
  • Loading branch information
itowlson authored Jul 23, 2024
2 parents 08eac60 + 9b73913 commit 4f4693e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/oci/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ impl Client {
async fn wasm_layer(file: &Path) -> Result<ImageLayer> {
tracing::trace!("Reading wasm module from {:?}", file);
Ok(ImageLayer::new(
fs::read(file).await.context("cannot read wasm module")?,
fs::read(file)
.await
.with_context(|| format!("cannot read wasm module {}", quoted_path(file)))?,
WASM_LAYER_MEDIA_TYPE.to_string(),
None,
))
Expand All @@ -522,7 +524,13 @@ impl Client {
/// Create a new data layer based on a file.
async fn data_layer(file: &Path, media_type: String) -> Result<ImageLayer> {
tracing::trace!("Reading data file from {:?}", file);
Ok(ImageLayer::new(fs::read(&file).await?, media_type, None))
Ok(ImageLayer::new(
fs::read(&file)
.await
.with_context(|| format!("cannot read file {}", quoted_path(file)))?,
media_type,
None,
))
}

fn content_ref_for_layer(&self, layer: &ImageLayer) -> ContentRef {
Expand Down

0 comments on commit 4f4693e

Please sign in to comment.