Skip to content

Improve error message when scan target path doesn't exist #3

@Ap6pack

Description

@Ap6pack

Problem

When you run malwar scan /nonexistent/path, the error message is a Python traceback rather than a friendly CLI error. Users should see a clear message like:

Error: Path '/nonexistent/path' does not exist.

How to Fix

  1. Open src/malwar/cli/app.py — the scan command handler
  2. Add a path existence check before the scan begins
  3. Use typer.BadParameter or rich.console.print with [red] styling for a clean error
  4. Also handle the case where the path exists but contains no .md files (currently says "No .md files found" which is good, but could suggest checking the path)

Testing

Add a test in tests/ that verifies:

  • Scanning a nonexistent path gives a clear error message and exit code 1
  • Scanning an empty directory gives a helpful message

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions