simonw / shot-scraper

A command-line utility for taking automated screenshots of websites
https://shot-scraper.datasette.io
Apache License 2.0
1.57k stars 70 forks source link

--fail-on-error overlaps with --fail #103

Closed simonw closed 1 year ago

simonw commented 1 year ago

When I built --fail in #102 I missed that shot-scraper multi already has a similar option, --fail-on-error.

That option turns out to not do much though:

https://github.com/simonw/shot-scraper/blob/378a27cefc45390537c93f73d5415f3e819f2b29/shot_scraper/cli.py#L352-L357

https://github.com/simonw/shot-scraper/blob/378a27cefc45390537c93f73d5415f3e819f2b29/shot_scraper/cli.py#L439-L444

That's the only place it actually has an impact: if a page times out and --fail-on-error is set then you get an error, otherwise it gets skipped.

simonw commented 1 year ago

That option was added in: https://github.com/simonw/shot-scraper/commit/68fe39024bd6febe2cb8bbc2f7de7a4f5a432301

See also:

simonw commented 1 year ago

Potential solutions:

simonw commented 1 year ago

Demo:

% echo '- url: https://datasette.io/' | shot-scraper multi - --timeout 1 --fail
Error: Timeout 1ms exceeded.
=========================== logs ===========================
navigating to "https://datasette.io/", waiting until "load"
============================================================
% echo $?                                                                      
1
% echo '- url: https://datasette.io/' | shot-scraper multi - --timeout 1       
Timeout 1ms exceeded.
=========================== logs ===========================
navigating to "https://datasette.io/", waiting until "load"
============================================================
% echo $?                                                               
0