Clarify error that occurs when getting the hash of an on-demand file (#1722)

* Clarify Error

- Clarifies error that occurs when attempting to read the metadata from an on-demand file

* Make error more better

Changed 'Attempted' to 'Failed'

* Add comment and conditional compilation
This commit is contained in:
Carter
2023-11-13 11:39:22 -06:00
committed by GitHub
parent 5705f40aae
commit be004e2cf2

View File

@@ -124,7 +124,22 @@ async fn identifier_job_step(
(metadata, file_path),
)
})
.map_err(|e| error!("Failed to extract file metadata: {e:#?}"))
.map_err(|e| {
#[cfg(target_os = "windows")]
{
// Handle case where file is on-demand (NTFS only)
if e.source.raw_os_error().map_or(false, |code| code == 362) {
error!("Failed to extract metadata from on-demand file: {e:#?}");
} else {
error!("Failed to extract file metadata: {e:#?}")
}
}
#[cfg(not(target_os = "windows"))]
{
error!("Failed to extract file metadata: {e:#?}");
}
})
.ok()
}),
)