Skip to content

Exit with code 1 on HTTP errors#187

Open
lamsal27 wants to merge 1 commit into
jarun:mainfrom
lamsal27:fix-exit-code-on-http-error
Open

Exit with code 1 on HTTP errors#187
lamsal27 wants to merge 1 commit into
jarun:mainfrom
lamsal27:fix-exit-code-on-http-error

Conversation

@lamsal27

@lamsal27 lamsal27 commented Jun 1, 2026

Copy link
Copy Markdown

When an HTTP error occurs (e.g. 403 Forbidden), the error was logged to stderr but the process exited with code 0. This makes it impossible for wrapper scripts to detect failure: ddgr --np search && do_something would always execute do_something regardless of whether the search succeeded.
Changed return None to sys.exit(1) in the fetch_page exception handler.
Fixes #83.

Previously, fetch failures were logged to stderr but the process
exited with code 0, making it impossible for wrapper scripts to
detect failure. Fixes jarun#83.
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.

ddgr returns 0 exit code on HTTP Errors

1 participant