Mercurial > hgrepos > Python > apps > py-cutils
changeset 375:7044c2900890
FIX: Convert the ultimate parse errors for a .treesum file into a real ValueError.
Do not assert such important runtime errors.
BUGS: Should be a dedicated exception type.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 05 May 2025 09:21:55 +0200 |
| parents | c19a21180a8f |
| children | 54a6d4534ef4 |
| files | cutils/treesum.py |
| diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/cutils/treesum.py Mon May 05 08:53:35 2025 +0200 +++ b/cutils/treesum.py Mon May 05 09:21:55 2025 +0200 @@ -1870,7 +1870,8 @@ else: return (algo_name, mo.group(2), None, None) else: - assert False, line + raise ValueError( + "Cannot parse line: %r" % (line,)) return line def _get_next_line(self): @@ -1932,7 +1933,9 @@ block_no = 0 for record in reader: if record[0] == "VERSION": - assert record[1] == "1" + if record[1] != "1": + raise ValueError( + "VERSION not yet handled: %r" % (record[1],)) # start a new block in_block = True block_no += 1
