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 serveTracks(app *model.AppState) http.Handler {
tracks, err := controller.GetAllTracks(app.DB)
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch tracks: %s\n", err)
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch tracks: %v\n", err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
@ -32,7 +32,7 @@ func serveTracks(app *model.AppState) http.Handler {
Tracks: tracks,
})
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin tracks page: %s\n", err)
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin tracks page: %v\n", err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}
})
@ -44,7 +44,7 @@ func serveTrack(app *model.AppState, trackID string) http.Handler {
track, err := controller.GetTrack(app.DB, trackID)
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin track page for %s: %s\n", trackID, err)
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch track %s: %v\n", trackID, err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
@ -55,7 +55,7 @@ func serveTrack(app *model.AppState, trackID string) http.Handler {
releases, err := controller.GetTrackReleases(app.DB, track.ID, true)
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch releases for track %s: %s\n", trackID, err)
fmt.Fprintf(os.Stderr, "WARN: Failed to fetch releases for track %s: %v\n", trackID, err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
@ -72,7 +72,7 @@ func serveTrack(app *model.AppState, trackID string) http.Handler {
Releases: releases,
})
if err != nil {
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin track page for %s: %s\n", trackID, err)
fmt.Fprintf(os.Stderr, "WARN: Failed to serve admin track page for %s: %v\n", trackID, err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}
})