Skip to content

Commit 9b73913

Browse files
committed
Tell user which file we failed to read
Signed-off-by: itowlson <[email protected]>
1 parent 5d028fb commit 9b73913

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/oci/src/client.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,9 @@ impl Client {
513513
async fn wasm_layer(file: &Path) -> Result<ImageLayer> {
514514
tracing::trace!("Reading wasm module from {:?}", file);
515515
Ok(ImageLayer::new(
516-
fs::read(file).await.context("cannot read wasm module")?,
516+
fs::read(file)
517+
.await
518+
.with_context(|| format!("cannot read wasm module {}", quoted_path(file)))?,
517519
WASM_LAYER_MEDIA_TYPE.to_string(),
518520
None,
519521
))
@@ -522,7 +524,13 @@ impl Client {
522524
/// Create a new data layer based on a file.
523525
async fn data_layer(file: &Path, media_type: String) -> Result<ImageLayer> {
524526
tracing::trace!("Reading data file from {:?}", file);
525-
Ok(ImageLayer::new(fs::read(&file).await?, media_type, None))
527+
Ok(ImageLayer::new(
528+
fs::read(&file)
529+
.await
530+
.with_context(|| format!("cannot read file {}", quoted_path(file)))?,
531+
media_type,
532+
None,
533+
))
526534
}
527535

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

0 commit comments

Comments
 (0)