fix: add error handling for missing input files
Display human-readable errors when the markdown file, photo, or signature cannot be found instead of failing with a stack trace. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bc186be0f9
commit
03b8c509c3
2 changed files with 20 additions and 3 deletions
11
main.py
11
main.py
|
|
@ -15,7 +15,16 @@ def generate(
|
|||
),
|
||||
) -> None:
|
||||
"""Generate a PDF CV from a Markdown file with YAML frontmatter."""
|
||||
result = generate_pdf(input_file, output_file)
|
||||
if not input_file.exists():
|
||||
typer.echo(f"Error: Markdown file not found: {input_file}", err=True)
|
||||
raise typer.Exit(1)
|
||||
|
||||
try:
|
||||
result = generate_pdf(input_file, output_file)
|
||||
except FileNotFoundError as e:
|
||||
typer.echo(f"Error: {e}", err=True)
|
||||
raise typer.Exit(1)
|
||||
|
||||
typer.echo(f"Generated {result}")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue