Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/buck2_common/src/file_ops/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ pub(super) fn extended_ignore_error<'a>(
return Some(ReadDirError::DirectoryDoesNotExist {
path: path.to_owned(),
suggestion: DirectoryDoesNotExistSuggestion::Typo(
suggestion.to_owned(),
match parent.path().join_normalized(suggestion) {
Ok(p) => p.as_str().to_owned(),
Err(_) => suggestion.to_owned()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it's kinda weird to return the original suggestion on error since the suggestion is not relevant. Can we get the following behavior instead? On error, return NoSuggestion as suggestion and fire a soft_error!() that joining normalized paths unexpected failed when recommending suggestions.

}
),
});
}
Expand Down
2 changes: 2 additions & 0 deletions tests/core/errors/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ async def test_package_listing_errors(buck: Buck) -> None:
"//package_listing/data.file/subdir:target",
# Missing directory due to typo
"//package_listings:",
# Missing directory due to typo shows full path
"//package_listing/data.file:targets",
# Missing directory due to being in the wrong cell
"//something:",
]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ Caused by:
^-----------------------------^
path `root//package_listing/data.file` is a file, not a directory

Command failed:
Error evaluating expression:
//package_listing/data.file:targets:
^-----------------^


Caused by:
package `root//package_listing/data.file:targets:` does not exist
^--------------------^
dir `root//package_listing/data.file:targets` does not exist. Did you mean `root//package_listing/data.file:target`?




Command failed:
Expand Down
Loading