Skip to content

check_cards: a truncated response or bad status line ends the run with a traceback #220

Description

@realmarcin

From the round-1 review of #212.

Where: scripts/fleet/check_cards.py read_source().

The fetch catches HTTPError, URLError, TimeoutError and OSError. Two errors get past all of them, because they subclass http.client.HTTPException instead:

  • http.client.IncompleteRead, raised when the connection drops mid-body;
  • http.client.BadStatusLine.

main() prints only after check() returns. So one such error on any source loses the whole report: no rows, no summary, just a traceback and exit 1.

Evidence: against a local server, a truncated body raised "IncompleteRead(45 bytes read, 500 more expected)" out of main(), and none of the other three rows was printed. This predates #212, but #212's docstring says a fetch that did not arrive is a warning.

Fix: catch http.client.HTTPException as unread.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions