Skip to content

Commit

Permalink
Update filedownloader.go
Browse files Browse the repository at this point in the history
  • Loading branch information
trapacska authored Feb 13, 2024
1 parent c52429d commit fb6ce6a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion filedownloader/filedownloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ func download(context context.Context, client HTTPClient, source string, destina
}()

if resp.StatusCode != http.StatusOK {
responseBodyBytes, _ := io.ReadAll(resp.Body)
responseBodyBytes, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("unable to download file from: %s. Status code: %d", source, resp.StatusCode)
}
return fmt.Errorf("unable to download file from: %s. Status code: %d. Response body: %s", source, resp.StatusCode, string(responseBodyBytes))
}

Expand Down

0 comments on commit fb6ce6a

Please sign in to comment.