Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tell user which file we failed to read #2674

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading