Skip to content

Commit

Permalink
fix for Krasjet#37: print more informative error message when page nu…
Browse files Browse the repository at this point in the history
…mber can't be converted to an int
  • Loading branch information
outis committed Nov 11, 2024
1 parent 8276386 commit 88a8605
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pdftocio/tocparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ def parse_entry(entry: List, nLine: int) -> ToCEntry:
*entry[indent + 2:] # vpos
)
return toc_entry
except ValueError as e:
print(f"Unable to parse toc entry {entry} from line {nLine};",
f"Couldn't convert '{entry[indent + 1]}' to a page number.",
file=sys.stderr)
raise e
except IndexError as e:
print(f"Unable to parse toc entry {entry} from line {nLine};",
f"Need at least {indent + 2} parts but only have {len(entry)}.",
Expand Down

0 comments on commit 88a8605

Please sign in to comment.