From fae735d1c6c95a6b82e76a068f04894e0e68a55a Mon Sep 17 00:00:00 2001 From: martinek Date: Fri, 22 Aug 2025 09:14:53 +0200 Subject: [PATCH] Improve error handling in fs::read_to_string - Helps identify which file caused the read error --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index fae5c44..c012c51 100644 --- a/src/main.rs +++ b/src/main.rs @@ -187,7 +187,8 @@ fn output_file_to_markdown( trim: bool, out: &mut W, ) -> Result<(), Box> { - let content = fs::read_to_string(path)?; + let content = fs::read_to_string(path) + .map_err(|e| format!("Failed to read {}: {}", path.display(), e))?; let content_str = if trim { content.trim() } else {