Skip to content

Reports a browser job error for an HTTP error response#868

Merged
thp merged 11 commits into
thp:masterfrom
trevorshannon:bug/no-errors
Jul 10, 2026
Merged

Reports a browser job error for an HTTP error response#868
thp merged 11 commits into
thp:masterfrom
trevorshannon:bug/no-errors

Conversation

@trevorshannon

@trevorshannon trevorshannon commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Introduces a browser job option raise_for_status that, when true, will raise an error if the response has an HTTP error status. Omitting the option results in the same behavior as before this change.

Once the browser navigates to the page of interest (following any redirects), if the resulting HTTP status code is not in the range 200-299, an error is raised. This error is reported the same as an HTTP error in a url job: no traceback, showing only the status code & message.

This is particularly useful for keeping temporary 404 or 500 errors from polluting the job history for browser jobs.

fixes #867

@thp thp left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments. I think it's worthwhile to make the desired behaviour the default, as the option is otherwise a "fix the (buggy) legacy behavior" toggle that new users need enable to fix behaviour.

For consistency, having ignore_http_error_codes like UrlJob seems like a good idea.

We can always add spacebar heating back as an option later if someone complains (or not..).

Comment thread lib/urlwatch/jobs.py Outdated
Comment thread docs/source/jobs.rst Outdated
Comment thread lib/urlwatch/tests/test_handler.py
@trevorshannon
trevorshannon requested a review from thp July 8, 2026 01:16

@thp thp left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor style and wording comments to make it super clean. Rest looks good now. Thanks for working on this!

Comment thread lib/urlwatch/util.py Outdated
Comment thread lib/urlwatch/util.py Outdated
Comment thread lib/urlwatch/jobs.py Outdated
Comment thread docs/source/advanced.rst Outdated
@trevorshannon trevorshannon changed the title Optionally reports a browser job error for an HTTP error response Reports a browser job error for an HTTP error response Jul 9, 2026
@trevorshannon
trevorshannon requested a review from thp July 9, 2026 19:41

@thp thp left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now. Thanks!

@thp
thp merged commit 645796d into thp:master Jul 10, 2026
5 checks passed
@trevorshannon
trevorshannon deleted the bug/no-errors branch July 11, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

navigate jobs do not report errors like url jobs do.

2 participants