Skip to content

sites: include HTTP status + body snippet in data-fetch error#2940

Open
ChrisJr404 wants to merge 1 commit into
sherlock-project:masterfrom
ChrisJr404:improve-data-fetch-error-2924
Open

sites: include HTTP status + body snippet in data-fetch error#2940
ChrisJr404 wants to merge 1 commit into
sherlock-project:masterfrom
ChrisJr404:improve-data-fetch-error-2924

Conversation

@ChrisJr404
Copy link
Copy Markdown

Closes #2924.

When fetching MANIFEST_URL fails, the existing error gives the user nothing to go on:

Bad response while accessing data file URL '<url>'.

That makes it hard to tell whether they hit:

  • a 404 (URL moved — exactly what happened in Bad response while accessing data file URL #2924, where the user was on an older version pointing at the old raw.githubusercontent.com path)
  • a 5xx (host outage)
  • a captive-portal HTML page returned by an upstream proxy
  • some other failure mode

This includes the HTTP status code, the reason phrase, and the first 200 characters of the response body in the exception message. No behavior change — just makes the error self-diagnosable.

When sherlock fails to download the site manifest from MANIFEST_URL,
the previous error told the user only that the URL was bad:

    Bad response while accessing data file URL '<url>'.

This made it hard to tell apart a 404 (e.g. user is on an old version
where MANIFEST_URL has since moved), a 5xx (host outage), and a
captive-portal HTML page returned by an upstream proxy. Issue sherlock-project#2924
hit exactly this scenario.

Add the status code, the textual reason, and a 200-character snippet
of the response body so the cause is visible from the error message
alone, without users having to debug with curl.

Closes sherlock-project#2924
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.

Bad response while accessing data file URL

1 participant