mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-29 19:17:26 +00:00
Make more informative warning message when failed to parse pyproject.toml (#6009)
## Summary Added the actual error message to the warning when uv fails to parse `pyproject.toml`. Resolves https://github.com/astral-sh/uv/issues/5934 ## Test Plan Took the case from the issue: - have `pyproject.toml` which contains ``` [tool.uv] foobar = false ``` - ``` $ uv venv --preview -v ``` - Expect the message that contains the actual problem in the `pyproject.toml` like: ``` warning: Failed to parse `pyproject.toml` during settings discovery: unknown field `foobar`; skipping... ```
This commit is contained in:
parent
5c44937742
commit
798cc7bf3c
5 changed files with 24 additions and 4 deletions
|
|
@ -72,9 +72,13 @@ impl FilesystemOptions {
|
|||
Ok(None) => {
|
||||
// Continue traversing the directory tree.
|
||||
}
|
||||
Err(Error::PyprojectToml(file, _err)) => {
|
||||
Err(Error::PyprojectToml(file, err)) => {
|
||||
// If we see an invalid `pyproject.toml`, warn but continue.
|
||||
warn_user!("Failed to parse `{file}` during settings discovery; skipping...");
|
||||
warn_user!(
|
||||
"Failed to parse `{}` during settings discovery:\n{}",
|
||||
file.cyan(),
|
||||
textwrap::indent(&err.to_string(), " ")
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
// Otherwise, warn and stop.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue