Skip to content

Commit 1ed8a65

Browse files
committed
chore: better errors in humanize filesize
1 parent 3e1e879 commit 1ed8a65

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/file_keeper/core/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ def humanize_filesize(value: int | float, base: int = SI_BASE) -> str:
304304
elif base == BINARY_BASE:
305305
suffixes = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"]
306306
else:
307-
raise ValueError(base)
307+
msg = f"Base must be {SI_BASE} (SI) or {BINARY_BASE} (binary), got {base}"
308+
raise ValueError(msg)
308309

309310
iteration = 0
310311

0 commit comments

Comments
 (0)