Skip to content

Commit

Permalink
chore: Improving FS Error Message for op_realpath_sync and op_realpat…
Browse files Browse the repository at this point in the history
…h_async (#18404)

#17526
  • Loading branch information
WingZer0o authored and mmastrac committed Mar 31, 2023
1 parent 7fa2bf3 commit 02401b2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ext/fs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
})
Expand Down

0 comments on commit 02401b2

Please sign in to comment.