Skip to content

fix(cli): graceful handling for mwclient/requests exceptions#2

Open
tosfos wants to merge 1 commit intovedmaka:masterfrom
tosfos:fix/graceful-mwclient-exceptions
Open

fix(cli): graceful handling for mwclient/requests exceptions#2
tosfos wants to merge 1 commit intovedmaka:masterfrom
tosfos:fix/graceful-mwclient-exceptions

Conversation

@tosfos
Copy link
Copy Markdown
Contributor

@tosfos tosfos commented Mar 2, 2026

Catch MwClientError (LoginError, APIError, etc.) and RequestException (ConnectionError, Timeout) from build_site(), method(), maybe_convert_markdown() (site.parse), and iterator iteration. Print a clean message to stderr and exit 1 instead of dumping a raw traceback.

  • Add _handle_runtime_error() helper; optionally import requests.exceptions
  • Wrap maybe_convert_markdown in same try/except as method() so parse() failures are handled
  • Tests: APIError, ConnectionError, and iterator mid-stream raise

Made with Cursor

Catch MwClientError (LoginError, APIError, etc.) and RequestException
(ConnectionError, Timeout) from build_site(), method(), maybe_convert_markdown()
(site.parse), and iterator iteration. Print a clean message to stderr and
exit 1 instead of dumping a raw traceback.

- Add _handle_runtime_error() helper; optionally import requests.exceptions
- Wrap maybe_convert_markdown in same try/except as method() so parse() failures are handled
- Tests: APIError, ConnectionError, and iterator mid-stream raise

Made-with: Cursor
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.

1 participant