add error to http status?

This commit is contained in:
Antoni Sawicki 2024-07-02 02:57:00 -07:00
parent d036914fcb
commit a8b8a557f7

2
txt.go
View File

@ -95,7 +95,7 @@ func fetchImage(id, url string) error {
return fmt.Errorf("Error downloading %q: %v", url, err) return fmt.Errorf("Error downloading %q: %v", url, err)
} }
if r.StatusCode != http.StatusOK { if r.StatusCode != http.StatusOK {
return fmt.Errorf("%q status code: %v", url, r.StatusCode) return fmt.Errorf("Error %q HTTP Status Code: %v", url, r.StatusCode)
} }
defer r.Body.Close() defer r.Body.Close()
img, err = io.ReadAll(r.Body) img, err = io.ReadAll(r.Body)