Skip to content

Commit

Permalink
abort at non 200 error code
Browse files Browse the repository at this point in the history
  • Loading branch information
TiltedToast committed Sep 4, 2023
1 parent fe14ee5 commit 8510cc2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/models/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func (post *Post) Download(client *fasthttp.Client) {

logger.Debug(fmt.Sprintf("Downloading %s", url))

_, body, err := client.Get(nil, url)
if err != nil {
logger.Warn(fmt.Sprintf("Error downloading post: %s", err))
code, body, err := client.Get(nil, url)
if err != nil || code != fasthttp.StatusOK {
logger.Warn(fmt.Sprintf("[%d] Error downloading post: %s", code, err))
return
}

Expand Down

0 comments on commit 8510cc2

Please sign in to comment.