fix: check ignored errors
This commit is contained in:
@ -58,10 +58,14 @@ func Album(l *logrus.Logger) http.HandlerFunc {
|
||||
}
|
||||
|
||||
var a data.Album
|
||||
a.Parse(doc)
|
||||
if err = a.Parse(doc); err != nil {
|
||||
l.Error(err)
|
||||
}
|
||||
|
||||
views.AlbumPage(a).Render(context.Background(), w)
|
||||
|
||||
setCache(id, a)
|
||||
if err = setCache(id, a); err != nil {
|
||||
l.Errorln(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,9 +85,11 @@ func Annotations(l *logrus.Logger) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
setCache(id, body)
|
||||
_, err = w.Write(response)
|
||||
if err != nil {
|
||||
if err = setCache(id, body); err != nil {
|
||||
l.Errorln(err)
|
||||
}
|
||||
|
||||
if _, err = w.Write(response); err != nil {
|
||||
l.Errorln("Error sending response: ", err)
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,8 @@ func Lyrics(l *logrus.Logger) http.HandlerFunc {
|
||||
s.Parse(doc)
|
||||
|
||||
views.LyricsPage(s).Render(context.Background(), w)
|
||||
setCache(id, s)
|
||||
if err = setCache(id, s); err != nil {
|
||||
l.Errorln(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ func ImageProxy(l *logrus.Logger) http.HandlerFunc {
|
||||
}
|
||||
|
||||
w.Header().Add("Content-type", fmt.Sprintf("image/%s", ext))
|
||||
io.Copy(w, res.Body)
|
||||
if _, err = io.Copy(w, res.Body); err != nil {
|
||||
l.Errorln("unable to write image", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,11 @@ func Search(l *logrus.Logger) http.HandlerFunc {
|
||||
var sRes data.SearchResponse
|
||||
|
||||
d := json.NewDecoder(res.Body)
|
||||
d.Decode(&sRes)
|
||||
if err = d.Decode(&sRes); err != nil {
|
||||
l.Errorln(err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
views.ErrorPage(500, "something went wrong").Render(context.Background(), w)
|
||||
}
|
||||
|
||||
results := data.SearchResults{Query: query, Sections: sRes.Response.Sections}
|
||||
|
||||
|
Reference in New Issue
Block a user