Skip to content

Commit

Permalink
Improve error message if directory already exists in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
object-Object committed Sep 30, 2024
1 parent b9b51cb commit 6cc3354
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/hexdoc/data/sitemap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import shutil
import textwrap
from collections import defaultdict
from pathlib import Path

Expand Down Expand Up @@ -98,7 +99,13 @@ def delete_updated_books(*, src: Path, dst: Path, release: bool):
if dst_dir.exists():
if release:
raise ValueError(
f"Tried to overwrite book directory in release mode: {dst_dir}"
textwrap.dedent(
f"""
Release mode is enabled, refusing to overwrite existing directory: {dst_dir}
Note: this combination of mod and book version has already been released.
Try incrementing the book version number (usually in __version__.py).
"""
).strip()
)
shutil.rmtree(dst_dir)

Expand Down

0 comments on commit 6cc3354

Please sign in to comment.