Skip to content

Commit

Permalink
Use a nicer error message when pandoc fails
Browse files Browse the repository at this point in the history
  • Loading branch information
superatomic committed Mar 30, 2024
1 parent f9ff9f0 commit 26aa2cd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tldr_man/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,11 @@ def render_manpage(tldr_page: str) -> str:
try:
if PANDOC_LOCATION is None:
raise FileNotFoundError
return run([PANDOC_LOCATION, '-', '-s', '-t', 'man', '-f', 'markdown-tex_math_dollars-smart'],
input=res, stdout=PIPE, encoding="utf-8").stdout
pandoc = run([PANDOC_LOCATION, '-', '-s', '-t', 'man', '-f', 'markdown-tex_math_dollars-smart'],
input=res, stdout=PIPE, encoding="utf-8")
if pandoc.returncode:
raise Fail(f"Command 'pandoc' returned non-zero exit status {pandoc.returncode}")
return pandoc.stdout
except FileNotFoundError:
raise ExternalCommandNotFound('pandoc', PANDOC_MISSING_MESSAGE)

Expand Down

0 comments on commit 26aa2cd

Please sign in to comment.