The claim
python/README.md (Errors section): "Everything that stopped an edit from landing raises GitHubDocsError".
What the code does
In GitHubDocsClient._request (python/src/github_docs/client.py), the except urllib.error.HTTPError as e: handler calls e.read() to read the error body. If that read times out, or the connection is reset during it, the resulting socket.timeout / OSError is raised inside the handler. Python does not route an exception raised within an except block to that block's sibling clauses, so the except OSError clause added for #11 does not catch it, and it escapes unconverted.
Suggested fix
Wrap e.read() in the HTTPError handler so that an OSError there falls back to an empty body (the status-only message "GitHub API returned HTTP " already exists for exactly that case). Add a TestErrorSurface case in which _http_error(...).read raises socket.timeout.
Found during the self-review of PR #13, and deliberately left out of that PR's scope.
This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson
The claim
python/README.md(Errors section): "Everything that stopped an edit from landing raisesGitHubDocsError".What the code does
In
GitHubDocsClient._request(python/src/github_docs/client.py), theexcept urllib.error.HTTPError as e:handler callse.read()to read the error body. If that read times out, or the connection is reset during it, the resultingsocket.timeout/OSErroris raised inside the handler. Python does not route an exception raised within anexceptblock to that block's sibling clauses, so theexcept OSErrorclause added for #11 does not catch it, and it escapes unconverted.Suggested fix
Wrap
e.read()in theHTTPErrorhandler so that anOSErrorthere falls back to an empty body (the status-only message "GitHub API returned HTTP" already exists for exactly that case). Add aTestErrorSurfacecase in which_http_error(...).readraisessocket.timeout.Found during the self-review of PR #13, and deliberately left out of that PR's scope.
This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson