fix some bad error printing

+ fixed "blog" not being highlighted in admin sidebar when visited
This commit is contained in:
ari melody 2025-11-08 15:16:43 +00:00
parent b7c1d85830
commit 84e40b837a
Signed by: ari
GPG key ID: CF99829C92678188
5 changed files with 29 additions and 27 deletions

View file

@ -17,7 +17,7 @@ func serveArtists(app *model.AppState) http.Handler {
artists, err := controller.GetAllArtists(app.DB)
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch artists: %s\n", err)
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch artists: %v\n", err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
@ -32,7 +32,7 @@ func serveArtists(app *model.AppState) http.Handler {
Artists: artists,
})
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin artists page: %s\n", err)
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin artists page: %v\n", err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}
})
@ -48,14 +48,14 @@ func serveArtist(app *model.AppState, artistID string) http.Handler {
http.NotFound(w, r)
return
}
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch artist %s: %s\n", artistID, err)
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch artist %s: %v\n", artistID, err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
credits, err := controller.GetArtistCredits(app.DB, artist.ID, true)
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin artist page for %s: %s\n", artistID, err)
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch artist credits for %s: %v\n", artistID, err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
@ -72,7 +72,7 @@ func serveArtist(app *model.AppState, artistID string) http.Handler {
Credits: credits,
})
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin artist page for %s: %s\n", artistID, err)
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin artist page for %s: %v\n", artistID, err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}
})