diff options
Diffstat (limited to 'internal/api/photos.go')
| -rw-r--r-- | internal/api/photos.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/api/photos.go b/internal/api/photos.go index 92c5c04..ca6b038 100644 --- a/internal/api/photos.go +++ b/internal/api/photos.go @@ -12,12 +12,12 @@ func (s *Server) handlePhotos( ) { photos, err := s.gallery.Gallery(r.Context()) if err != nil { - log.Printf("gallery: %v", err) + log.Printf("build gallery: %v", err) - http.Error( + writeError( w, - http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, + "failed to build gallery", ) return } @@ -38,10 +38,12 @@ func (s *Server) handlePhotos( w.Header().Set("Content-Type", "application/json") if err := json.NewEncoder(w).Encode(response); err != nil { - http.Error( + log.Printf("encode photos response: %v", err) + + writeError( w, - http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, + "failed to encode response", ) } } |