Skip to content

Commit

Permalink
Add logging when failed to create grid
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Jul 6, 2024
1 parent b9c2762 commit 72054da
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions handlers/grid.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/RyanCarrier/dijkstra/v2"
"github.com/bamiaux/rez"
"github.com/gofiber/fiber/v2"
"github.com/rs/zerolog/log"
)

var transport = &http.Transport{
Expand Down Expand Up @@ -169,12 +170,14 @@ func Grid() fiber.Handler {
// Make request client.Get
res, err := client.Do(req)
if err != nil {
log.Error().Str("postID", postID).Err(err).Msg("Failed to get image")
return
}
defer res.Body.Close()

images[i], err = jpeg.Decode(res.Body)
if err != nil {
log.Error().Str("postID", postID).Err(err).Msg("Failed to decode image")
return
}
}(i, mediaURL)
Expand Down

0 comments on commit 72054da

Please sign in to comment.