Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cfengine_cli/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import os
import json
import subprocess
import textwrap

import markdown_it
from cfbs.pretty import pretty_file
Expand Down Expand Up @@ -375,8 +376,11 @@ def _run_formatter(tool, args, cwd, install_hint):
check=True,
cwd=cwd,
)
except:
raise UserError(f"Encountered an error running {tool}\nInstall: {install_hint}")
except FileNotFoundError:
raise UserError(f"'{tool}' not found. Install it with: {install_hint}")
except subprocess.CalledProcessError as e:
error_msg = textwrap.indent(str(e.stderr).strip(), "> ")
raise UserError(f"Encountered an error running {tool}:\n{error_msg}")
return result


Expand Down
Loading