fix(manage): HandleReorder gibt 400 bei Mismatch zurück, slog für 500-Fehler
This commit is contained in:
parent
4fab5fe28a
commit
052cf199ae
2 changed files with 9 additions and 1 deletions
|
|
@ -2,7 +2,9 @@ package manage
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -242,7 +244,12 @@ func HandleReorder(playlists *store.PlaylistStore, notifier *mqttnotifier.Notifi
|
|||
}
|
||||
|
||||
if err := playlists.Reorder(r.Context(), playlistID, ids); err != nil {
|
||||
http.Error(w, "db error", http.StatusInternalServerError)
|
||||
if errors.Is(err, store.ErrReorderMismatch) {
|
||||
http.Error(w, "item list mismatch", http.StatusBadRequest)
|
||||
} else {
|
||||
slog.Error("reorder failed", "err", err)
|
||||
http.Error(w, "db error", http.StatusInternalServerError)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -745,6 +745,7 @@ func HandleReorderUI(playlists *store.PlaylistStore, screens *store.ScreenStore,
|
|||
if errors.Is(err, store.ErrReorderMismatch) {
|
||||
http.Error(w, "item list mismatch", http.StatusBadRequest)
|
||||
} else {
|
||||
slog.Error("reorder failed", "err", err)
|
||||
http.Error(w, "db error", http.StatusInternalServerError)
|
||||
}
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue