Improve an error message when failed to load pyproject.toml (#653)
This commit is contained in:
parent
fe24a15b84
commit
3b72ed0d48
4
black.py
4
black.py
@ -160,7 +160,9 @@ def read_pyproject_toml(
|
||||
pyproject_toml = toml.load(value)
|
||||
config = pyproject_toml.get("tool", {}).get("black", {})
|
||||
except (toml.TomlDecodeError, OSError) as e:
|
||||
raise click.BadOptionUsage(f"Error reading configuration file: {e}", ctx)
|
||||
raise click.FileError(
|
||||
filename=value, hint=f"Error reading configuration file: {e}"
|
||||
)
|
||||
|
||||
if not config:
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user