Skip to content

Commit

Permalink
hsec-sync: improve HTTP error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
frasertweedale committed Jul 18, 2024
1 parent c546b13 commit d71b4c8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions code/hsec-sync/src/Security/Advisories/Sync/Snapshot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ overwriteSnapshot root url =
HttpExceptionRequest _ content ->
case content of
StatusCodeException response body ->
"Request failed with " <> show (response ^. responseStatus) <> ": " <> show body
"Request (GET " <> getSnapshotUrl url <> ") failed with " <> show (response ^. responseStatus) <> ": " <> show body
_ ->
"Request failed: " <> show content
"Request (GET " <> getSnapshotUrl url <> ") failed: " <> show content
Right result -> do
performed <-
liftIO $
Expand Down Expand Up @@ -205,9 +205,9 @@ latestUpdate url =
HttpExceptionRequest _ content ->
case content of
StatusCodeException response body ->
"Request failed with " <> show (response ^. responseStatus) <> ": " <> show body
"Request (HEAD " <> getSnapshotUrl url <> ") failed with " <> show (response ^. responseStatus) <> ": " <> show body
_ ->
"Request failed: " <> show content
"Request (HEAD " <> getSnapshotUrl url <> ") failed: " <> show content
Right result ->
case result ^? responseHeader "etag" of
Nothing -> throwE $ FetchSnapshotArchive "Missing ETag header"
Expand Down

0 comments on commit d71b4c8

Please sign in to comment.