File / lines: src/gmaps_scraper/cli.py, lines 342-350
Problem: When --kind place is used in batch mode, scrape_places() can return PlaceScrapeResult objects whose error field is set, but main() always prints the wrapped JSON and returns 0. The test test_place_kind_can_scrape_batch_from_input_file in tests/test_cli.py even encodes this behavior: it asserts exit_code == 0 even though a mocked result has "error": "blocked".
Why it matters: In CI/automation, the scraper reports success when every URL failed. Callers must parse JSON to detect failures.
Suggested fix:
- Add
--fail-on-error flag.
- When set, after emitting the JSON payload,
main() returns a non-zero exit code if any result has error is not None.
- Keep the default behavior unchanged to avoid breaking existing scripts, or change the default with a major version note.
- Add/update tests asserting stderr content and exit code.
Difficulty: good-first-issue / medium
Impact: High — pipeline-friendly observability improvement.
File / lines:
src/gmaps_scraper/cli.py, lines 342-350Problem: When
--kind placeis used in batch mode,scrape_places()can returnPlaceScrapeResultobjects whoseerrorfield is set, butmain()always prints the wrapped JSON and returns0. The testtest_place_kind_can_scrape_batch_from_input_fileintests/test_cli.pyeven encodes this behavior: it assertsexit_code == 0even though a mocked result has"error": "blocked".Why it matters: In CI/automation, the scraper reports success when every URL failed. Callers must parse JSON to detect failures.
Suggested fix:
--fail-on-errorflag.main()returns a non-zero exit code if any result haserror is not None.Difficulty: good-first-issue / medium
Impact: High — pipeline-friendly observability improvement.