diff options
author | Mike Mulchrone <mtmulch0191@outlook.com> | 2023-03-26 05:20:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-26 12:20:51 +0300 |
commit | 3c5350f9493d2e1e9f6ec1816290c17b118eeba4 (patch) | |
tree | 122953c9776a25c3275363ae4b0679c574be1b6b /ext/fs/lib.rs | |
parent | 0742ea1170239b7d010e219b3349b2f9edaaefe5 (diff) |
chore: Improving FS Error Message for op_realpath_sync and op_realpath_async (#18404)
#17526
Diffstat (limited to 'ext/fs/lib.rs')
-rw-r--r-- | ext/fs/lib.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs index 9c889d9b2..c00f39599 100644 --- a/ext/fs/lib.rs +++ b/ext/fs/lib.rs @@ -1456,7 +1456,9 @@ where debug!("op_realpath_sync {}", path.display()); // corresponds to the realpath on Unix and // CreateFile and GetFinalPathNameByHandle on Windows - let realpath = canonicalize_path(&path)?; + let realpath = canonicalize_path(&path).map_err(|error| { + default_err_mapper(error, format!("op_realpath_sync '{}'", path.display())) + })?; let realpath_str = into_string(realpath.into_os_string())?; Ok(realpath_str) } @@ -1488,7 +1490,12 @@ where debug!("op_realpath_async {}", path.display()); // corresponds to the realpath on Unix and // CreateFile and GetFinalPathNameByHandle on Windows - let realpath = canonicalize_path(&path)?; + let realpath = canonicalize_path(&path).map_err(|error| { + default_err_mapper( + error, + format!("op_realpath_async '{}'", path.display()), + ) + })?; let realpath_str = into_string(realpath.into_os_string())?; Ok(realpath_str) }) |