more admin dashboard polish, some code cleanup
This commit is contained in:
parent
65f277b3f2
commit
c547fca0d7
27 changed files with 187 additions and 270 deletions
|
|
@ -324,6 +324,10 @@ func UpdateReleaseTracks(app *model.AppState, release *model.Release) http.Handl
|
|||
|
||||
err = controller.UpdateReleaseTracks(app.DB, release.ID, trackIDs)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "duplicate key") {
|
||||
http.Error(w, "Release cannot have duplicate tracks", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if strings.Contains(err.Error(), "no rows") {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
|
|
@ -366,14 +370,14 @@ func UpdateReleaseCredits(app *model.AppState, release *model.Release) http.Hand
|
|||
err = controller.UpdateReleaseCredits(app.DB, release.ID, credits)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "duplicate key") {
|
||||
http.Error(w, "Artists may only be credited once\n", http.StatusBadRequest)
|
||||
http.Error(w, "Artists may only be credited once", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if strings.Contains(err.Error(), "no rows") {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
fmt.Printf("WARN: Failed to update links for %s: %s\n", release.ID, err)
|
||||
fmt.Printf("WARN: Failed to update credits for %s: %s\n", release.ID, err)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
|
|
@ -394,6 +398,10 @@ func UpdateReleaseLinks(app *model.AppState, release *model.Release) http.Handle
|
|||
|
||||
err = controller.UpdateReleaseLinks(app.DB, release.ID, links)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "duplicate key") {
|
||||
http.Error(w, "Release cannot have duplicate link names", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if strings.Contains(err.Error(), "no rows") {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue