Skip to content

Commit 628c19b

Browse files
sbernauerTechassi
andauthored
chore: Improve file not found error message (#305)
* chore: Improve file not found error message * Apply suggestions from code review Co-authored-by: Techassi <[email protected]> --------- Co-authored-by: Techassi <[email protected]>
1 parent e95a4e7 commit 628c19b

File tree

1 file changed

+8
-3
lines changed
  • rust/stackable-cockpit/src/xfer

1 file changed

+8
-3
lines changed

rust/stackable-cockpit/src/xfer/mod.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ type Result<T, E = Error> = core::result::Result<T, E>;
1919

2020
#[derive(Debug, Snafu)]
2121
pub enum Error {
22-
#[snafu(display("failed to read local file"))]
23-
ReadLocalFile { source: std::io::Error },
22+
#[snafu(display("failed to read from local file from {path:?}"))]
23+
ReadLocalFile {
24+
source: std::io::Error,
25+
path: PathBuf,
26+
},
2427

2528
#[snafu(display("failed to create cache from provided settings"))]
2629
CacheSettings { source: cache::Error },
@@ -82,7 +85,9 @@ impl Client {
8285
}
8386

8487
async fn get_from_local_file(&self, path: &PathBuf) -> Result<String> {
85-
fs::read_to_string(path).await.context(ReadLocalFileSnafu)
88+
fs::read_to_string(path)
89+
.await
90+
.context(ReadLocalFileSnafu { path })
8691
}
8792

8893
/// Internal method which either looks up the requested file in the cache

0 commit comments

Comments
 (0)