Commit 3b72ed0d authored by Tsuyoshi Hombashi's avatar Tsuyoshi Hombashi Committed by Jelle Zijlstra
Browse files

Improve an error message when failed to load pyproject.toml (#653)

parent fe24a15b
Loading
Loading
Loading
Loading
+3 −1
Changes for black.py: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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