Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
simonw opened this issue Jan 30, 2023 · 3 comments
Closed

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

simonw opened this issue Jan 30, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Jan 30, 2023

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:

@click.option(
"--timeout",
type=int,
help="Wait this many milliseconds before failing",
)
@click.option("--fail-on-error", is_flag=True, help="Fail noisily on error")

except TimeoutError as e:
if fail_on_error:
raise click.ClickException(str(e))
else:
click.echo(str(e), err=True)
continue

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 simonw added the bug Something isn't working label Jan 30, 2023
@simonw
Copy link
Owner Author

simonw commented Jan 30, 2023

@simonw
Copy link
Owner Author

simonw commented Jan 30, 2023

Potential solutions:

  • Leave it alone.
  • Deprecate --fail-on-error - use hidden=True to hide it from --help - but have --fail also handle that timeout case

@simonw
Copy link
Owner Author

simonw commented Jan 30, 2023

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

simonw added a commit that referenced this issue Jan 30, 2023
@simonw simonw closed this as completed Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant