diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-28 10:24:48 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-28 10:24:48 +0100 |
| commit | 34d6ca51955fc2a10de326de5d2ac8f81cf660bb (patch) | |
| tree | c9249c42cf90f859404a3af7d1ab76541c6340e4 /generat3d/config.py | |
| parent | 8431493b1de912196ea66b9f27c89e4c68658d56 (diff) | |
| download | generat3D-34d6ca51955fc2a10de326de5d2ac8f81cf660bb.tar.gz generat3D-34d6ca51955fc2a10de326de5d2ac8f81cf660bb.zip | |
Fail loudly on unreadable config and empty library roots
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Diffstat (limited to 'generat3d/config.py')
| -rw-r--r-- | generat3d/config.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/generat3d/config.py b/generat3d/config.py index 9ea7266..804723f 100644 --- a/generat3d/config.py +++ b/generat3d/config.py @@ -39,6 +39,8 @@ def library_roots(cli_roots, path=None): data = tomllib.load(f) except tomllib.TOMLDecodeError as e: raise Error(f"{path}: {e}") from None + except OSError as e: + raise Error(f"{path}: {e.strerror or e}") from None unknown = sorted(set(data) - KEYS) if unknown: raise Error(f"{path}: unknown keys: {', '.join(unknown)}") @@ -49,6 +51,8 @@ def library_roots(cli_roots, path=None): raise Error(f"no library roots: pass -L or set library_roots in {path}") out = [] for r in roots: + if not r.strip(): + raise Error("empty library root") p = Path(r).expanduser() if not p.is_dir(): raise Error(f"library root not found: {p}") |
